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

Method testGoObject

bind/java/ClassesTest.java:80–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

78 }
79
80 public void testGoObject() {
81 Runnable r = new GoRunnable();
82 r.run();
83 assertEquals("GoRunnable.toString", r.toString(), Javapkg.ToStringPrefix);
84 Runnable r2 = ((GoRunnable)r).getThis();
85 assertTrue("GoObject.this", r == r2);
86 Object o = new GoObject();
87 assertEquals("GoObject hashCode", 42, o.hashCode());
88 Object o2 = Javapkg.constructGoObject();
89 assertEquals("GoObject hashCode", 42, o2.hashCode());
90 assertTrue("GoObject.toString", o.toString().startsWith(Javapkg.ToStringPrefix));
91 Javapkg.runRunnable(r);
92 final boolean[] ran = new boolean[1];
93 Runnable r3 = new Runnable(){
94 @Override public void run() {
95 ran[0] = true;
96 }
97 };
98 Javapkg.runRunnable(r3);
99 assertTrue("RunRunnable", ran[0]);
100 assertTrue("RunnableRoundtrip Java", r3 == Javapkg.runnableRoundtrip(r3));
101 assertTrue("RunnableRoundtrip Go", r == Javapkg.runnableRoundtrip(r));
102 Runnable r5 = Javapkg.constructGoRunnable();
103 r5.run();
104 }
105
106 public void testTypedException() {
107 InputStream is = new GoInputStream();

Callers

nothing calls this directly

Calls 1

runMethod · 0.45

Tested by

no test coverage detected