Inheritance of annotated methods
simon.kulessa Mar 24, 2014 12:13 PMAs mentioned in my other ticket I have recently updated our JSF (Trinidad) webapp from weld 1.1.8.Final to 2.1.2.Final.
I have written the following test, that shows that annotated method's from SuperClasses are not considered after the update.
This test is based on the newest Arquillian version with the weld-ee-container,
which might not support Weld 2.1.2.Final (I've asked this question in the related arquillian forum).
Regardless the same applies to the real webapp.
The test works fine with weld 1.1.8.Final.
I assume that this scenario is a valid scenario, unlike my other question.
Ps.:
If someone needs the appropriate dependencies I can post them as well.
________________________________________
package test;
import static org.junit.Assert.assertTrue;
import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.ByteArrayAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
abstract class AbstractClass {
@PostConstruct
public abstract void init();
}
@ApplicationScoped
class Impl extends AbstractClass {
private boolean invoked = false;
public void init() {
invoked = true;
}
public boolean isInvoked() {
return invoked;
}
}
@RunWith(Arquillian.class)
public class ArquillianTest {
@Deployment
public static JavaArchive createTestArchive() {
return ShrinkWrap
.create(JavaArchive.class, "test.jar")
.addClasses(Impl.class)
.addAsManifestResource(
new ByteArrayAsset(
("<beans></beans>").getBytes()), ArchivePaths.create("beans.xml"));
}
@Inject
Impl impl;
@Test
public void testInvoke() {
assertTrue(impl.isInvoked());
}
}