Debian Codegraph @

templates/gradle-projects/NewAndroidModule/root/test/app_package/ExampleInstrumentedTest.java.ftl

raw
1 package ${packageName};
2
3 import android.content.Context;
4 import android.support.test.InstrumentationRegistry;
5 import android.support.test.runner.AndroidJUnit4;
6
7 import org.junit.Test;
8 import org.junit.runner.RunWith;
9
10 import static org.junit.Assert.*;
11
12 /**
13 * Instrumentation test, which will execute on an Android device.
14 *
15 * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
16 */
17 @RunWith(AndroidJUnit4.class)
18 public class ExampleInstrumentedTest {
19 @Test
20 public void useAppContext() throws Exception {
21 // Context of the app under test.
22 Context appContext = InstrumentationRegistry.getTargetContext();
23
24 <#if isLibraryProject?? && isLibraryProject>
25 assertEquals("${packageName}.test", appContext.getPackageName());
26 <#else>
27 assertEquals("${packageName}", appContext.getPackageName());
28 </#if>
29 }
30 }