@Test public void testCustomerService() { JsonObject obj = Json.createObjectBuilder() .add("name", "John") .add("surname", "Smith").build(); given() .contentType("application/json") .body(obj.toString()) .when() .post("/customers") .then() .statusCode(201); given() .when().get("/customers") .then() .statusCode(200) .body(containsString("John"), containsString("Smith")); obj = Json.createObjectBuilder() .add("id", "0") .add("name", "Donald") .add("surname", "Duck").build(); given() .contentType("application/json") .body(obj.toString()) .when() .put("/customers") .then() .statusCode(204); given() .contentType("application/json") .when() .delete("/customers?id=0") .then() .statusCode(204); }
@DELETE public Response delete(@QueryParam("id") Integer customerId) { customerRepository.deleteCustomer(customerId); return Response.status(204).build(); }
CustomerEndpoint { @DELETE public Response delete(@QueryParam("id") Integer customerId) { customerRepository.deleteCustomer(customerId); return Response.status(204).build(); } }
CustomerEndpoint { @DELETE public Response delete(@QueryParam("id") Integer customerId) { customerRepository.deleteCustomer(customerId); return Response.status(204).build(); }  }
CustomerEndpoint { @DELETE public Response delete(@QueryParam("id") Integer customerId) { customerRepository.deleteCustomer(customerId); return Response.status(204).build(); }  @GET List<Customer> getAll(); @POST Response create(Customer customer); @PUT Response update(Customer customer); @DELETE Response delete(@QueryParam("id") Integer customerId); @GET @Path("writefile") @Produces("text/plain") CompletionStage<String> writeFile(); @GET @Path("readfile") CompletionStage<String> readFile(); }
CustomerEndpoint { @DELETE public Response delete(@QueryParam("id") Integer customerId) { customerRepository.deleteCustomer(customerId); return Response.status(204).build(); }  @GET List<Customer> getAll(); @POST Response create(Customer customer); @PUT Response update(Customer customer); @DELETE Response delete(@QueryParam("id") Integer customerId); @GET @Path("writefile") @Produces("text/plain") CompletionStage<String> writeFile(); @GET @Path("readfile") CompletionStage<String> readFile();  }