@Test public void testCustomerService() { given() .when().get("/customers") .then() .statusCode(200) .body("$.size()", is(2)); JsonObject objOrder = Json.createObjectBuilder() .add("item", "bike") .add("price", new Long(100)) .build(); given() .contentType("application/json") .body(objOrder.toString()) .when() .post("/orders/1") .then() .statusCode(201); objOrder = Json.createObjectBuilder() .add("id", new Long(1)) .add("item", "mountain bike") .add("price", new Long(100)) .build(); given() .contentType("application/json") .body(objOrder.toString()) .when() .put("/orders") .then() .statusCode(204); given() .when().get("/orders?customerId=1") .then() .statusCode(200) .body(containsString("mountain bike")); given() .when().delete("/orders/1") .then() .statusCode(204); }
@DELETE public Response delete(@QueryParam("id") Long customerId) { customerRepository.deleteCustomer(customerId); return Response.status(204).build(); }
CustomerEndpoint { @DELETE public Response delete(@QueryParam("id") Long customerId) { customerRepository.deleteCustomer(customerId); return Response.status(204).build(); } }
CustomerEndpoint { @DELETE public Response delete(@QueryParam("id") Long customerId) { customerRepository.deleteCustomer(customerId); return Response.status(204).build(); }  }
CustomerEndpoint { @DELETE public Response delete(@QueryParam("id") Long 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") Long customerId); }
CustomerEndpoint { @DELETE public Response delete(@QueryParam("id") Long 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") Long customerId);  }