blob: e3b5ddf6f4cfc93ff96284d6c1f1d3309e211eb0 [file] [log] [blame]
Hugo Benichi06b1f2b2017-07-24 09:30:52 +09001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.net.ip;
18
Erik Kline84714bf2017-05-19 09:29:48 +090019import static org.mockito.Mockito.anyString;
20import static org.mockito.Mockito.when;
Hugo Benichi06b1f2b2017-07-24 09:30:52 +090021
Remi NGUYEN VAN97f69c22019-01-20 20:35:06 +090022import android.content.Context;
Erik Kline8bd00d52017-12-08 17:47:50 +090023import android.net.util.InterfaceParams;
Hugo Benichi06b1f2b2017-07-24 09:30:52 +090024import android.net.util.SharedLog;
Erik Kline84714bf2017-05-19 09:29:48 +090025import android.os.Handler;
26import android.os.Looper;
Hugo Benichi06b1f2b2017-07-24 09:30:52 +090027import android.support.test.filters.SmallTest;
28import android.support.test.runner.AndroidJUnit4;
29
30import org.junit.Before;
31import org.junit.Test;
32import org.junit.runner.RunWith;
33import org.mockito.Mock;
34import org.mockito.MockitoAnnotations;
35
36
37/**
38 * Tests for IpReachabilityMonitor.
39 */
40@RunWith(AndroidJUnit4.class)
41@SmallTest
42public class IpReachabilityMonitorTest {
43
44 @Mock IpReachabilityMonitor.Callback mCallback;
45 @Mock IpReachabilityMonitor.Dependencies mDependencies;
46 @Mock SharedLog mLog;
Remi NGUYEN VAN97f69c22019-01-20 20:35:06 +090047 @Mock Context mContext;
Erik Kline84714bf2017-05-19 09:29:48 +090048 Handler mHandler;
Hugo Benichi06b1f2b2017-07-24 09:30:52 +090049
50 @Before
51 public void setUp() {
52 MockitoAnnotations.initMocks(this);
Erik Kline84714bf2017-05-19 09:29:48 +090053 when(mLog.forSubComponent(anyString())).thenReturn(mLog);
54 mHandler = new Handler(Looper.getMainLooper());
Hugo Benichi06b1f2b2017-07-24 09:30:52 +090055 }
56
57 IpReachabilityMonitor makeMonitor() {
Erik Kline8bd00d52017-12-08 17:47:50 +090058 final InterfaceParams ifParams = new InterfaceParams("fake0", 1, null);
Remi NGUYEN VAN97f69c22019-01-20 20:35:06 +090059 return new IpReachabilityMonitor(
60 mContext, ifParams, mHandler, mLog, mCallback, false, mDependencies);
Hugo Benichi06b1f2b2017-07-24 09:30:52 +090061 }
62
63 @Test
64 public void testNothing() {
65 IpReachabilityMonitor monitor = makeMonitor();
66 }
67}