-
Notifications
You must be signed in to change notification settings - Fork 136
Expand file tree
/
Copy pathJavaTest.java.tmpl
More file actions
27 lines (24 loc) · 995 Bytes
/
JavaTest.java.tmpl
File metadata and controls
27 lines (24 loc) · 995 Bytes
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
package com.google.firebase.test;
import android.app.Activity;
import org.junit.Assert;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
/** A test wrapper that wraps around native C++ code that calls RUN_ALL_TESTS(). */
@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE)
public final class $wrapper_name {
@Test
public void testFirebase() throws Exception {
Activity activity = Robolectric.buildActivity(Activity.class).setup().get();
TemporaryFolder tempDir = new TemporaryFolder();
tempDir.create();
final String log = tempDir.newFile("googletest.log").getAbsolutePath();
int result = runAllTests(log, activity);
Assert.assertEquals("Error running a C++ test! Check sponge for details.", 0, result);
}
private native int runAllTests(String log, Activity activity);
}