Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3eb99bda authored by Brad Ebinger's avatar Brad Ebinger
Browse files

Adds testing framework to com.android.ims

Test: Adding
Change-Id: I8da86a5b9bc54cf56c95844d4845be38a61a9221
parent 6c7a14d2
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -20,8 +20,6 @@ LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/src/java
LOCAL_SRC_FILES := \
    $(call all-java-files-under, src/java)

#LOCAL_JAVA_LIBRARIES := telephony-common

LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := ims-common

tests/Android.mk

0 → 100644
+33 −0
Original line number Diff line number Diff line
#
# Copyright (C) 2016 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.
#

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_SRC_FILES := $(call all-java-files-under, src)

LOCAL_PACKAGE_NAME := ImsCommonTests
LOCAL_CERTIFICATE := platform

LOCAL_MODULE_TAGS := tests

LOCAL_JAVA_LIBRARIES := ims-common android.test.runner

LOCAL_STATIC_JAVA_LIBRARIES := \
        android-support-test \
        mockito-target-minus-junit4

include $(BUILD_PACKAGE)
 No newline at end of file
+35 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2016 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
  -->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.android.ims.tests">

    <application android:label="@string/app_name">
        <uses-library android:name="android.test.runner" />
    </application>

    <!--
        To run all tests:
            adb shell am instrument -w com.android.ims.tests/android.support.test.runner.AndroidJUnitRunner

        To run a single class test:
            adb shell am instrument -e class com.android.ims.unit.FooUnitTest -w com.android.ims.tests/android.support.test.runner.AndroidJUnitRunner
    -->
    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
        android:targetPackage="com.android.ims.tests"
        android:label="Ims Common Tests" />
</manifest>
+21 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2016 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
  -->

<resources>
    <!-- Application label -->
    <string name="app_name">ImsCommonTests</string>
</resources>
+64 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 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 com.android.ims;

import android.support.test.runner.AndroidJUnit4;

import com.android.ims.internal.IImsConfig;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;

import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.verify;

/**
 * Unit Tests for ImsConfig
 */
@RunWith(AndroidJUnit4.class)
public class ImsConfigTest extends ImsTestBase {

    @Mock IImsConfig mMockImsConfigInterface;

    ImsConfig mTestImsConfig;

    @Before
    @Override
    public void setUp() throws Exception {
        super.setUp();
        mTestImsConfig = new ImsConfig(mMockImsConfigInterface, mContext);
    }

    @After
    @Override
    public void tearDown() throws Exception {
        mTestImsConfig = null;
        super.tearDown();
    }

    @Test
    public void testImsConfigGetProvisionedValue() throws Exception {
        int testItem = 0;

        mTestImsConfig.getProvisionedValue(testItem);

        verify(mMockImsConfigInterface).getProvisionedValue(eq(testItem));
    }
}
Loading