private static final int EXPECTED_ANNNOTATED_CHILD_ONLY = 2;
private static final int EXPECTED_ANNNOTATED_CHILD_BASEOVERRIDDEN = 2;
public void testProxiedAndAdvisedChild() throws Exception
{
Child proxiedChild = (Child)getBean("ProxiedChild");
assertTrue(proxiedChild instanceof Advised);
assertTrue(proxiedChild instanceof AspectManaged);
TestInterceptor.reset();
proxiedChild.baseOnly();
//Two bindings will apply to this method
assertEquals(EXPECTED_ANNNOTATED_CHILD_BASEOVERRIDDEN, TestInterceptor.interceptions);
assertNotNull(TestInterceptor.invoked);
assertEquals("baseOnly", TestInterceptor.invoked.getName());
assertNotNull(TestInterceptor.classAnnotation);
assertTrue(TestInterceptor.classAnnotation instanceof org.jboss.test.microcontainer.support.Test);
assertNull(TestInterceptor.methodAnnotation);
assertNull(TestInterceptor.metadata);
TestInterceptor.reset();
proxiedChild.childOnly();
assertEquals(EXPECTED_ANNNOTATED_CHILD_ONLY, TestInterceptor.interceptions);
assertNotNull(TestInterceptor.invoked);
assertEquals("childOnly", TestInterceptor.invoked.getName());
assertNotNull(TestInterceptor.classAnnotation);
assertTrue(TestInterceptor.classAnnotation instanceof org.jboss.test.microcontainer.support.Test);
assertNull(TestInterceptor.methodAnnotation);
assertNull(TestInterceptor.metadata);
TestInterceptor.reset();
proxiedChild.baseOverridden();
assertEquals(EXPECTED_ANNNOTATED_CHILD_BASEOVERRIDDEN, TestInterceptor.interceptions);
assertNotNull(TestInterceptor.invoked);
assertEquals("baseOverridden", TestInterceptor.invoked.getName());
assertNotNull(TestInterceptor.classAnnotation);
assertTrue(TestInterceptor.classAnnotation instanceof org.jboss.test.microcontainer.support.Test);