vendredi 24 juillet 2015

DeltaSpike CDI Testing + NPE Faces Context

I want to implement a CDI Test with DeltaSpike. But when I try to call a function that depends on the Faces Context, I yield a Null Pointer Exception.

Do I need to mock the class or can it be initialized in a better way?

@RunWith(CdiTestRunner.class)
public class DeltaSpikeTest{

    @Inject
    private WindowContext windowContext;

    @Inject 
    private TestBean testBean;

    @Test
    public void main() {
        this.windowContext.activateWindow("w1");

        testBean.methodThatUsesFacesContext(); // NPE
    }
}

Every help is highly appreciated!

Aucun commentaire:

Enregistrer un commentaire