String className = One.class.getCanonicalName();
byte klazz[] = proxetta.builder(One.class).create();
//FileUtil.writeBytes("d:\\OneClone.class", klazz);
FastByteArrayOutputStream fbaos = new FastByteArrayOutputStream();
// PrintStream out = System.out;
System.setOut(new PrintStream(fbaos));
One one = (One) ClassLoaderUtil.defineClass((new StringBuilder()).append(className).append(JoddProxetta.invokeProxyClassNameSuffix).toString(), klazz).newInstance();
assertEquals("one ctor!one ctor!", fbaos.toString()); // clone ctor calls super ctor,
fbaos.reset();
one.example1();
assertEquals("REPLACED VIRTUAL! jodd.proxetta.inv.Two * one!173>overriden sub", fbaos.toString());
fbaos.reset();
one.example2();
assertEquals("REPLACED STATIC! one * jodd/proxetta/inv/Two * example2 * void example2() * jodd.proxetta.inv.One * jodd.proxetta.inv.One$$Clonetou!15013static: 4", fbaos.toString());
fbaos.reset();
one.example3();
assertEquals("state = REPLACED ctor!", fbaos.toString());
fbaos.reset();
assertEquals("jodd.proxetta.inv.One$$Clonetou", one.getClass().getName());
assertTrue(one instanceof Serializable);
Annotation[] anns = one.getClass().getAnnotations();