### Question:
FruitResource { @POST public Set<Fruit> add(Fruit fruit) { fruits.add(fruit); return fruits; } FruitResource(); @GET Set<Fruit> list(); @POST Set<Fruit> add(Fruit fruit); @DELETE Set<Fruit> delete(Fruit fruit);  }### Answer:
@Test public void testAdd() { given() .body("{\"name\": \"Pear\", \"description\": \"Winter fruit\"}") .header("Content-Type", MediaType.APPLICATION_JSON) .when() .post("/fruits") .then() .statusCode(200) .body("$.size()", is(3), "name", containsInAnyOrder("Apple", "Pineapple", "Pear"), "description", containsInAnyOrder("Winter fruit", "Tropical fruit", "Winter fruit")); given() .body("{\"name\": \"Pear\", \"description\": \"Winter fruit\"}") .header("Content-Type", MediaType.APPLICATION_JSON) .when() .delete("/fruits") .then() .statusCode(200) .body("$.size()", is(2), "name", containsInAnyOrder("Apple", "Pineapple"), "description", containsInAnyOrder("Winter fruit", "Tropical fruit")); }