[MS01] Add the IP memory store service.
Bug: 116512211 Test: Added initial tests Change-Id: I9d9af4097e3e2d7afd9956b9cbfa29a9f9558ae0
This commit is contained in:
53
tests/net/java/android/net/IpMemoryStoreTest.java
Normal file
53
tests/net/java/android/net/IpMemoryStoreTest.java
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package android.net;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.mockito.Mockito.doReturn;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.RemoteException;
|
||||||
|
import android.support.test.filters.SmallTest;
|
||||||
|
import android.support.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.mockito.Mock;
|
||||||
|
import org.mockito.MockitoAnnotations;
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
@SmallTest
|
||||||
|
public class IpMemoryStoreTest {
|
||||||
|
@Mock
|
||||||
|
Context mMockContext;
|
||||||
|
@Mock
|
||||||
|
IIpMemoryStore mMockService;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
MockitoAnnotations.initMocks(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO : remove this useless test
|
||||||
|
@Test
|
||||||
|
public void testVersion() throws RemoteException {
|
||||||
|
doReturn(30).when(mMockService).version();
|
||||||
|
final IpMemoryStore store = new IpMemoryStore(mMockContext, mMockService);
|
||||||
|
assertEquals(store.version(), 30);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user