mercredi 30 mars 2016

Jersey test - Http Delete method with JSON request

I am using Jersey Test to test Rest service DELETE method:

@DELETE
@Path("/myPath")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public MyResponse myMethod(MyRequest myRequest) {

I have tried the example below and other methods:

Entity<MyRequest> requestEntity = Entity.entity(new MyRequest(arg1, arg2), MediaType.APPLICATION_JSON);
target(MY_URI).request(MediaType.APPLICATION_JSON).method("DELETE", requestEntity)

But it does not work.

How to make Http Delete in Jersey test?

Aucun commentaire:

Enregistrer un commentaire