summaryrefslogtreecommitdiff
path: root/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/utl/AndroidToolsTests.java
blob: 1ad01a1c3fdee2de8667521be2142d7306230bab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.smartdevicelink.test.utl;

import android.content.ComponentName;

import androidx.test.ext.junit.runners.AndroidJUnit4;

import com.smartdevicelink.util.AndroidTools;

import junit.framework.Assert;

import org.junit.Test;
import org.junit.runner.RunWith;

import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;

@RunWith(AndroidJUnit4.class)
public class AndroidToolsTests {

    @Test
    public void testIsServiceExportedNormal() {

        try {
            AndroidTools.isServiceExported(getInstrumentation().getTargetContext(), new ComponentName(getInstrumentation().getTargetContext(), "test"));
        } catch (Exception e) {
            Assert.fail("Exception during normal test: " + e.getMessage());
        }

    }

    @Test
    public void testIsServiceExportedNull() {

        try {
            AndroidTools.isServiceExported(getInstrumentation().getTargetContext(), null);
            Assert.fail("Proccessed null data");
        } catch (Exception e) {

        }

    }

}