128129130131132133134135136137138
b.addln("%s = true;", calledField); b.end(); transformation.prefixMethod(method, b.toString()); // cache the return value b.clear(); b.begin(); b.addln("%s = $_;", fieldName); b.end(); transformation.extendExistingMethod(method, b.toString()); }
115116117118119120121122123124125
IdAllocator a = new IdAllocator(); assertEquals(a.allocateId("foo"), "foo"); assertEquals(a.allocateId("foo_0"), "foo_0"); a.clear(); assertEquals(a.allocateId("foo"), "foo"); assertEquals(a.allocateId("foo_0"), "foo_0"); }
6465666768697071727374
{ Environment e = new EnvironmentImpl(); try { e.clear(); unreachable(); } catch (IllegalStateException ex) { assertMessageContains(ex, "no longer supported"); }
6869707172737475767778
replay(); e.push(Runnable.class, r1); e.push(Runnable.class, r2); e.clear(); assertNull(e.peek(Runnable.class)); verify(); }