Am 24.11.2011 13:12, schrieb Gerhard Petracek:
hi christian,

you need additional test-dependencies. you can have a look at a working
config at [1].

regards,
gerhard

[1]
http://code.google.com/a/apache-extras.org/p/myfaces-codi-examples/source/browse/community/pom.xml

http://www.irian.at

Your JSF/JEE powerhouse -
JEE Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces



2011/11/24 Christian Beikov<c.bei...@curecomp.com>

Hello!

I finally got myself to try out the JUnit-CDI tests but the actual result
is dissappointing. I added the following libraries to the build path of a
project:

myfaces-extcdi-base-test-**infrastructure-1.0.1.jar
myfaces-extcdi-bundle-jsf20-1.**0.1.jar
myfaces-extcdi-cargo-support-**module-1.0.1.jar
myfaces-extcdi-jsf-support-**module-1.0.1.jar
myfaces-extcdi-junit-support-**module-1.0.1.jar
myfaces-extcdi-owb-support-**module-1.0.1.jar
myfaces-test20-1.0.4.jar
openwebbeans-impl-1.1.2.jar
openwebbeans-spi-1.1.2.jar

....and also the Websphere 8.0 libs.
My first test case is minimal:

@RunWith(JUnit4.class)
public class CoreExceptionHandlerTest extends
org.apache.myfaces.extensions.**cdi.test.junit4.**AbstractCdiAwareTest{

    @Inject
    private CoreExceptionHandlerTestBean bean;

    @Test
    public void testCoreExceptionHandler() {
        try {
            bean.provokeException();
        } catch (Exception e) {
            fail();
        }
    }
}

When i try to run it, I get the following Exception:

java.lang.NullPointerException
    at org.apache.myfaces.extensions.**cdi.test.TestContainerFactory.**
isServletContextAwareContainer**(TestContainerFactory.java:**142)
    at org.apache.myfaces.extensions.**cdi.test.TestContainerFactory.**
getNewCdiTestContainer(**TestContainerFactory.java:120)
    at org.apache.myfaces.extensions.**cdi.test.TestContainerFactory.**
createTestContainer(**TestContainerFactory.java:56)
    at org.apache.myfaces.extensions.**cdi.test.strategy.**
AbstractCdiAwareTestStrategy.**before(**AbstractCdiAwareTestStrategy.**
java:73)
    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(**
NativeMethodAccessorImpl.java:**60)
    at sun.reflect.**DelegatingMethodAccessorImpl.**invoke(**
DelegatingMethodAccessorImpl.**java:37)
    at java.lang.reflect.Method.**invoke(Method.java:611)
    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.**BlockJUnit4ClassRunner.**runChild(**
BlockJUnit4ClassRunner.java:**76)
    at org.junit.runners.**BlockJUnit4ClassRunner.**runChild(**
BlockJUnit4ClassRunner.java:**50)
    at org.junit.runners.**ParentRunner$3.run(**ParentRunner.java:193)
    at org.junit.runners.**ParentRunner$1.schedule(**ParentRunner.java:52)
    at org.junit.runners.**ParentRunner.runChildren(**
ParentRunner.java:191)
    at org.junit.runners.**ParentRunner.access$000(**ParentRunner.java:42)
    at org.junit.runners.**ParentRunner$2.evaluate(**ParentRunner.java:184)
    at org.junit.runners.**ParentRunner.run(ParentRunner.**java:236)
    at org.eclipse.jdt.internal.**junit4.runner.**JUnit4TestReference.run(*
*JUnit4TestReference.java:49)
    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)

java.lang.NullPointerException
    at org.apache.myfaces.extensions.**cdi.test.strategy.**
AbstractCdiAwareTestStrategy.**after(**AbstractCdiAwareTestStrategy.**
java:87)
    at org.apache.myfaces.extensions.**cdi.test.strategy.**
AbstractCdiAwareTestStrategy.**afterMethod(**AbstractCdiAwareTestStrategy.
**java:54)
    at org.apache.myfaces.extensions.**cdi.test.junit4.**
AbstractCdiAwareTest.**afterMethod(**AbstractCdiAwareTest.java:47)
    at sun.reflect.**NativeMethodAccessorImpl.**invoke0(Native Method)
    at sun.reflect.**NativeMethodAccessorImpl.**invoke(**
NativeMethodAccessorImpl.java:**60)
    at sun.reflect.**DelegatingMethodAccessorImpl.**invoke(**
DelegatingMethodAccessorImpl.**java:37)
    at java.lang.reflect.Method.**invoke(Method.java:611)
    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.RunAfters.evaluate(**
RunAfters.java:37)
    at org.junit.runners.**BlockJUnit4ClassRunner.**runChild(**
BlockJUnit4ClassRunner.java:**76)
    at org.junit.runners.**BlockJUnit4ClassRunner.**runChild(**
BlockJUnit4ClassRunner.java:**50)
    at org.junit.runners.**ParentRunner$3.run(**ParentRunner.java:193)
    at org.junit.runners.**ParentRunner$1.schedule(**ParentRunner.java:52)
    at org.junit.runners.**ParentRunner.runChildren(**
ParentRunner.java:191)
    at org.junit.runners.**ParentRunner.access$000(**ParentRunner.java:42)
    at org.junit.runners.**ParentRunner$2.evaluate(**ParentRunner.java:184)
    at org.junit.runners.**ParentRunner.run(ParentRunner.**java:236)
    at org.eclipse.jdt.internal.**junit4.runner.**JUnit4TestReference.run(*
*JUnit4TestReference.java:49)
    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)

Could anyone help me please? I alread read something about that on the
mailing list, but adding all libraries as suggested did not help me.

Regards,
Christian

Thanks for your fast answer Gerhard!

I am unfortunately not using Maven because it is not really working with IBM software. I have added the libraries to the Build Path of the project in which the tests are located, but it does not work. What could the exception mean?

Regards,
Christian

Reply via email to