I am currently attempting to write some unit tests for a REST API written using Jersey. I saw a quite nice tutorial which however unfortunately deals with Jersey version 1.9 and not the current version 2.15. Unfortunately the migration guide does not seem to adress the problems I am experiencing. I am attempting to setup an external test:
@Override
protected TestContainerFactory getTestContainerFactory() {
return new ExternalTestContainerFactory();
}
The problem is that I need to implement the configure()
method. Currently my attempt looks like this:
@Override
protected Application configure() {
return new ResourceConfig(SomeResource.class);
}
The problem seems to be that the client()
method returns null
, so I can't create any target()
requests to test anything. Unfortunately the examples which I found all deal with Jersey version 1.x and do not seem to be applicable to my situation. Could anyone tell me what is going wrong or provide me with a code sample of a working test?!
Aucun commentaire:
Enregistrer un commentaire