package jodd.proxetta;

import jodd.proxetta.data.Hero;
import jodd.proxetta.data.HeroProxyAdvice;
import jodd.proxetta.impl.ProxyProxetta;

import jodd.proxetta.pointcuts.AllRealMethodsPointcut;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class AnnTest {

	@Test
	public void testMethodAnnotations() {
		ProxyProxetta proxyProxetta = ProxyProxetta
				.withAspects(
					new ProxyAspect(HeroProxyAdvice.class,
							new AllRealMethodsPointcut() {
								@Override
								public boolean apply(MethodInfo methodInfo) {
									if (!methodInfo.isTopLevelMethod()) {
										return false;
									}
									return super.apply(methodInfo);
								}
							}))
				//.setDebugFolder("/Users/igor/")
				;

		ProxettaBuilder proxettaBuilder = proxyProxetta.builder();
		proxettaBuilder.setTarget(Hero.class);
		Hero hero = (Hero) proxettaBuilder.newInstance();

		assertEquals("BatmanHero37W88.3CatWoman99speeeeedXRAY", hero.name());
	}

}
@@ -159,63 +159,239 @@
 tta.
-pointcuts.AllRealMethodsPointcut;%0Aimport org.junit.Test
+impl.WrapperProxetta;%0Aimport jodd.proxetta.impl.WrapperProxettaBuilder;%0Aimport jodd.proxetta.pointcuts.AllRealMethodsPointcut;%0Aimport jodd.util.ReflectUtil;%0Aimport org.junit.Test;%0A%0Aimport java.lang.reflect.InvocationTargetException
 ;%0A%0Ai
@@ -500,16 +500,17 @@
 otations
+1
 () %7B%0A%09%09P
@@ -1144,9 +1144,801 @@
 ));%0A%09%7D%0A%0A
+%09@Test%0A%09public void testMethodAnnotations2() throws IllegalAccessException, NoSuchMethodException, InvocationTargetException %7B%0A%09%09WrapperProxetta proxyProxetta = WrapperProxetta%0A%09%09%09%09.withAspects(%0A%09%09%09%09%09new ProxyAspect(HeroProxyAdvice.class,%0A%09%09%09%09%09%09%09new AllRealMethodsPointcut() %7B%0A%09%09%09%09%09%09%09%09@Override%0A%09%09%09%09%09%09%09%09public boolean apply(MethodInfo methodInfo) %7B%0A%09%09%09%09%09%09%09%09%09if (!methodInfo.isTopLevelMethod()) %7B%0A%09%09%09%09%09%09%09%09%09%09return false;%0A%09%09%09%09%09%09%09%09%09%7D%0A%09%09%09%09%09%09%09%09%09return super.apply(methodInfo);%0A%09%09%09%09%09%09%09%09%7D%0A%09%09%09%09%09%09%09%7D))%0A%09%09%09%09//.setDebugFolder(%22/Users/igor/%22)%0A%09%09%09%09;%0A%0A%09%09WrapperProxettaBuilder proxettaBuilder = proxyProxetta.builder();%0A%09%09proxettaBuilder.setTarget(Hero.class);%0A%09%09Object hero = proxettaBuilder.newInstance();%0A%0A%09%09assertEquals(%22BatmanHero37W88.3CatWoman99speeeeedXRAY%22, ReflectUtil.invoke(hero, %22name%22));%0A%09%7D%0A%0A
 %7D

Test added