From d3829de504e154dcd43b237e57a59a8e67a2b85d Mon Sep 17 00:00:00 2001 From: Chalard Jean Date: Tue, 4 Dec 2018 20:20:56 +0900 Subject: [PATCH] [MS01] Add the IP memory store service. Bug: 116512211 Test: Added initial tests Change-Id: I9d9af4097e3e2d7afd9956b9cbfa29a9f9558ae0 --- .../java/android/net/IpMemoryStoreTest.java | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 tests/net/java/android/net/IpMemoryStoreTest.java diff --git a/tests/net/java/android/net/IpMemoryStoreTest.java b/tests/net/java/android/net/IpMemoryStoreTest.java new file mode 100644 index 0000000000..0de7302c21 --- /dev/null +++ b/tests/net/java/android/net/IpMemoryStoreTest.java @@ -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); + } +}