コード例 #1
0
 @Test
 public void testSerializableProxy() throws Exception {
   DynamicType.Loaded<Foo> loaded =
       instrument(Foo.class, MethodDelegation.to(SerializationCheck.class));
   Foo instance = loaded.getLoaded().newInstance();
   assertThat(instance.qux(), is((Object) (FOO + QUX)));
 }
コード例 #2
0
 @Test
 public void testBridgeMethodResolution() throws Exception {
   DynamicType.Loaded<Bar> loaded = instrument(Bar.class, MethodDelegation.to(GenericBaz.class));
   Bar instance = loaded.getLoaded().newInstance();
   assertThat(instance.qux(BAR), is(BAR + QUX));
 }
コード例 #3
0
 @Test(expected = AbstractMethodError.class)
 public void testSuperCallOnAbstractMethod() throws Exception {
   DynamicType.Loaded<FooBarQuxBaz> loaded =
       instrument(FooBarQuxBaz.class, MethodDelegation.to(FooBar.class));
   loaded.getLoaded().newInstance().qux();
 }
コード例 #4
0
 @Test
 public void testSuperInstanceUnsafe() throws Exception {
   DynamicType.Loaded<Foo> loaded = instrument(Foo.class, MethodDelegation.to(QuxBaz.class));
   Foo instance = loaded.getLoaded().newInstance();
   assertThat(instance.qux(), is((Object) (FOO + QUX)));
 }