使用WindowBeanHolder的Arquillian配置DeploymentException

时间:2015-10-16 11:27:38

标签: java-ee-7 jboss-arquillian

我正在建立一个测试套件,以便在arquillian上执行它们。我跟着这个Arquillian's starting guide 我使用这个gradle来测试我的测试:

providedCompile 'org.jboss.spec:jboss-javaee-7.0:1.0.3.Final'

testCompile 'junit:junit:4.12'
testCompile 'org.hamcrest:hamcrest-junit:2.0.0.0'
testCompile 'org.jglue.cdi-unit:cdi-unit:3.1.3'
testCompile 'org.mockito:mockito-core:2.0.31-beta'
testCompile 'eu.codearte.catch-exception:catch-exception:2.0.0-ALPHA-1'
testCompile 'com.jayway.restassured:rest-assured:2.6.0'
testCompile 'com.carrotsearch:junit-benchmarks:0.7.2'

testCompile 'org.jboss.arquillian.junit:arquillian-junit-container:1.1.9.Final'
testCompile 'org.jboss.arquillian:arquillian-bom:1.1.9.Final'
testCompile 'org.jboss.arquillian.container:arquillian-weld-ee-embedded-1.1:1.0.0.CR9'
testCompile 'org.jboss.weld:weld-core:2.3.0.Final'
testCompile 'org.jboss.shrinkwrap:shrinkwrap-depchain:1.2.2'
testCompile 'org.apache.deltaspike.core:deltaspike-core-api:1.5.0'
testCompile 'org.apache.deltaspike.core:deltaspike-core-impl:1.5.0'
testCompile 'org.slf4j:slf4j-simple:1.7.12'

当我从Eclipse执行测试时:

它抛弃了我一个例外:

<configuration>
    <appSettings>
        <add key="environment" value="developmentorg.jboss.weld.exceptions.DeploymentException: Exception List with 1 exceptions:
        Exception 0 :
        java.lang.IllegalStateException: Could not find beans for Type=class org.apache.deltaspike.core.impl.scope.window.WindowBeanHolder and qualifiers:[]
            at org.apache.deltaspike.core.api.provider.BeanProvider.getContextualReference(BeanProvider.java:150)
            at org.apache.deltaspike.core.impl.scope.DeltaSpikeContextExtension.initializeDeltaSpikeContexts(DeltaSpikeContextExtension.java:85)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

1 个答案:

答案 0 :(得分:3)

添加

.addPackages(true, "org.apache.deltaspike")

到ShrinkWrap代码。