@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))); }
public static String baz(@Super(strategy = Super.Instantiation.UNSAFE) Foo foo) { assertThat(foo, not(instanceOf(Serializable.class))); return foo.qux() + QUX; }
public static String baz(@Super Foo foo) { assertThat(foo, not(instanceOf(Serializable.class))); return foo.qux() + QUX; }
@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))); }
public static String baz(@Super(serializableProxy = true) Foo foo) { assertThat(foo, instanceOf(Serializable.class)); return foo.qux() + QUX; }