myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Andraschko <zoi...@googlemail.com>
Subject Multiple test methods in AbstractCdiAwareTest
Date Tue, 22 Nov 2011 15:57:47 GMT
Hi,

i trying to use multiple test methods in my JUnit testcase.
The problem is, on the second method call, a exception will be thrown by
CODI.
AFAICS CODI will initialize the ViewConfig a second time.
Is this a known limitation?

A example:
public class MyTest extends AbstractCdiAwareTest {
     @Test public void testA() {...}
     @Test public void testB() {...}
}

The exception:
java.lang.IllegalArgumentException: /pages/accessDenied.xhtml is already
mapped to /pages/accessDenied.xhtml via xxx.Pages$AccessDenied -> a further
view definition (xxx.Pages$AccessDenied) is invalid
    at
org.apache.myfaces.extensions.cdi.jsf.impl.util.ExceptionUtils.ambiguousViewDefinitionException(ExceptionUtils.java:188)
    at
org.apache.myfaces.extensions.cdi.jsf.impl.config.view.ViewConfigCache.storeViewDefinition(ViewConfigCache.java:191)
    at
org.apache.myfaces.extensions.cdi.jsf.impl.config.view.ViewConfigCache.storeViewConfigDescriptor(ViewConfigCache.java:208)
    at
org.apache.myfaces.extensions.cdi.jsf.impl.config.view.ViewConfigCache.addViewConfigDescriptor(ViewConfigCache.java:94)
    at
org.apache.myfaces.extensions.cdi.jsf.impl.config.view.ViewConfigExtension.addPageDefinition(ViewConfigExtension.java:161)
    at
org.apache.myfaces.extensions.cdi.jsf.impl.config.view.ViewConfigExtension.processPageDefinitions(ViewConfigExtension.java:94)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at
org.apache.webbeans.intercept.InterceptorHandler.invoke(InterceptorHandler.java:329)
    at
org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.invoke(NormalScopedBeanInterceptorHandler.java:122)
    at
org.apache.myfaces.extensions.cdi.jsf.impl.config.view.ViewConfigExtension_$$_javassist_0.processPageDefinitions(ViewConfigExtension_$$_javassist_0.java)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at
org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:292)
    at
org.apache.webbeans.event.NotificationManager.fireEvent(NotificationManager.java:461)
    at
org.apache.webbeans.container.BeanManagerImpl.fireEvent(BeanManagerImpl.java:473)
    at
org.apache.webbeans.util.WebBeansUtil.fireProcessAnnotatedTypeEvent(WebBeansUtil.java:2125)
    at
org.apache.webbeans.config.BeansDeployer.deploySingleAnnotatedType(BeansDeployer.java:548)
    at
org.apache.webbeans.config.BeansDeployer.deployFromClassPath(BeansDeployer.java:494)
    at
org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:166)
    at
org.apache.webbeans.lifecycle.AbstractLifeCycle.startApplication(AbstractLifeCycle.java:127)
    at
org.apache.webbeans.cditest.owb.CdiTestOpenWebBeansContainer.bootContainer(CdiTestOpenWebBeansContainer.java:58)
    at
org.apache.myfaces.extensions.cdi.test.owb.AbstractOpenWebBeansTestContainer.startContainer(AbstractOpenWebBeansTestContainer.java:46)
    at
org.apache.myfaces.extensions.cdi.test.strategy.AbstractCdiAwareTestStrategy.before(AbstractCdiAwareTestStrategy.java:75)
    at
org.apache.myfaces.extensions.cdi.test.strategy.AbstractCdiAwareTestStrategy.beforeMethod(AbstractCdiAwareTestStrategy.java:44)
    at
org.apache.myfaces.extensions.cdi.test.junit4.AbstractCdiAwareTest.beforeMethod(AbstractCdiAwareTest.java:37)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
    at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69)
    at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:292)
    at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)


Thanks and best regards,
Thomas

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message