MCPcopy Create free account
hub / github.com/golang/mobile / ClassesTest

Class ClassesTest

bind/java/ClassesTest.java:23–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21import javapkg.GoArrayList;
22
23public class ClassesTest extends InstrumentationTestCase {
24 public void testConst() {
25 assertEquals("const Float", Float.MIN_VALUE, Javapkg.floatMin());
26 assertEquals("const String", java.util.jar.JarFile.MANIFEST_NAME, Javapkg.manifestName());
27 assertEquals("const Int", 7, Integer.SIZE, Javapkg.integerBytes());
28 }
29
30 public void testFunction() {
31 Javapkg.systemCurrentTimeMillis();
32 }
33
34 public void testMethod() {
35 try {
36 assertEquals("Integer.decode", 0xff, Javapkg.integerDecode("0xff"));
37 } catch (Exception e) {
38 throw new RuntimeException(e);
39 }
40 Exception exc = null;
41 try {
42 Javapkg.integerDecode("obviously wrong");
43 } catch (Exception e) {
44 exc = e;
45 }
46 assertNotNull("IntegerDecode Exception", exc);
47 }
48
49 public void testOverloadedMethod() {
50 try {
51 assertEquals("Integer.parseInt", 0xc4, Javapkg.integerParseInt("c4", 16));
52 } catch (Exception e) {
53 throw new RuntimeException(e);
54 }
55 Exception exc = null;
56 try {
57 Javapkg.integerParseInt("wrong", 16);
58 } catch (Exception e) {
59 exc = e;
60 }
61 assertNotNull("integerParseInt Exception", exc);
62 assertEquals("Integer.valueOf", 42, Javapkg.integerValueOf(42));
63 }
64
65 public void testException() {
66 Exception exc = null;
67 try {
68 Javapkg.provokeRuntimeException();
69 } catch (Exception e) {
70 exc = e;
71 }
72 assertNotNull("RuntimeException", exc);
73 }
74
75 public void testField() {
76 GoRunnable r = new GoRunnable();
77 String f = r.getField();
78 }
79
80 public void testGoObject() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected