}
@Test
public void testProxyClassNames() {
ProxyProxetta proxyProxetta = ProxyProxetta.withAspects(new ProxyAspect(FooProxyAdvice.class, new AllMethodsPointcut()));
proxyProxetta.setVariableClassName(true);
ProxyProxettaBuilder builder = proxyProxetta.builder();
builder.setTarget(Foo.class);
Foo foo = (Foo) builder.newInstance();
assertNotNull(foo);
assertEquals(Foo.class.getName() + "$$Proxetta", StringUtil.substring(foo.getClass().getName(), 0, -1));
builder = proxyProxetta.builder();
builder.setTarget(Foo.class);
foo = (Foo) builder.newInstance();
assertNotNull(foo);
assertEquals(Foo.class.getName() + "$$Proxetta", StringUtil.substring(foo.getClass().getName(), 0, -1));
proxyProxetta.setClassNameSuffix("$$Ppp");
builder = proxyProxetta.builder();
builder.setTarget(Foo.class);
foo = (Foo) builder.newInstance();
assertNotNull(foo);
assertEquals(Foo.class.getName() + "$$Ppp", StringUtil.substring(foo.getClass().getName(), 0, -1));
proxyProxetta.setClassNameSuffix("$$Proxetta");
proxyProxetta.setVariableClassName(false);
builder = proxyProxetta.builder(Foo.class, ".Too");
foo = (Foo) builder.newInstance();
assertNotNull(foo);
assertEquals(Foo.class.getPackage().getName() + ".Too$$Proxetta", foo.getClass().getName());
builder = proxyProxetta.builder();
builder.setTarget(Foo.class);
builder.setTargetProxyClassName("foo.");
foo = (Foo) builder.newInstance();
assertNotNull(foo);
assertEquals("foo.Foo$$Proxetta", foo.getClass().getName());
proxyProxetta.setClassNameSuffix(null);
builder = proxyProxetta.builder();
builder.setTargetProxyClassName("foo.Fff");
builder.setTarget(Foo.class);
foo = (Foo) builder.newInstance();
assertNotNull(foo);