1 package com.google.android.textclassifier.tests; 2 3 import static com.google.common.truth.Truth.assertThat; 4 5 import org.junit.Before; 6 import org.junit.Test; 7 import org.junit.runner.RunWith; 8 import org.junit.runners.JUnit4; 9 10 import android.content.Context; 11 import androidx.test.InstrumentationRegistry; 12 13 14 /** This is a launcher of the tests because we need a valid JNIEnv in some C++ tests. */ 15 @RunWith(JUnit4.class) 16 public class JvmTestLauncher { 17 18 @Before setUp()19 public void setUp() throws Exception { 20 System.loadLibrary("jvm_test_launcher"); 21 } 22 testsMain(Context context)23 private native boolean testsMain(Context context); 24 25 @Test testNative()26 public void testNative() throws Exception { 27 assertThat(testsMain(InstrumentationRegistry.getContext())).isTrue(); 28 } 29 } 30