mercredi 7 novembre 2018

JerseyTest.target() fails to generate WebTarget

I'm writing test classes for a Java project where apparently JerseyTest.java is used. We then use the WebTarget instance to call eg. a GET method from the remote API:

Response output = target(GetURIFromResource(RoleItemResource.class))
                .queryParam("id", roleId)
                .queryParam("token", token)
                .request()
                .get();

I also used this inside methods marked with "@After" and it works everywhere except one test class where the target() method throws a NullPointerException for some reason. The GetURIFromResource() does generate a correct URI there for the target() method to use as the argument.

What could I be doing wrong in this specific class?

Aucun commentaire:

Enregistrer un commentaire