### Question:
BooksEndpoint { @POST @Path("{id}/censor") public Response censorBook(@PathParam("id") String id) { final Books matchingBooks = books.list().filterById(id); if (null == id || matchingBooks.isEmpty() || matchingBooks.first().getStatus() == States.CENSORED) { return Response.status(Response.Status.BAD_REQUEST).entity("Could not process this request").build(); } matchingBooks.first().censor(); return Response.accepted(matchingBooks.first()).build(); } BooksEndpoint(BooksRepository books); @GET @Path("") Response getAllBooks(@QueryParam("title") String title, @QueryParam("author") String author, @QueryParam("id") String id, @QueryParam("state") String state); @POST @Path("{id}/rent/{user}") Response rentBook(@PathParam("id") String id, @PathParam("user") String userId); @POST @Path("{id}/return") Response returnBook(@PathParam("id") String id); @POST @Path("{id}/censor") Response censorBook(@PathParam("id") String id); @POST @Path("{id}/uncensor") Response uncensorBook(@PathParam("id") String id); @POST @Path("{id}/prepare") Response initialPreparation(@PathParam("id") String id); @POST @Produces(MediaType.TEXT_PLAIN) @Path("") Response addNewBook(
            @FormParam("title") String title,
            @FormParam("author") String author
    );  }### Answer:
@Test public void censor_a_book() throws IOException { addBook(TDD_IN_JAVA); final Response response = censorBook(withId(0)); checkBookDetails(response, 0, hasStatus(4)); }
@Test public void cannot_retrieve_a_censored_book() throws IOException { addBook(TDD_IN_JAVA); censorBook(withId(0)); final Response book = getBook(withId(0)); book.prettyPrint(); book.then().body("empty", is(true)); }