TreatmentsResource extends BaseResource { @DELETE public void clearTreatments(@PathParam("experimentName") String experimentName) { ensureExists(experiments.get(experimentName)) .clearTreatments() .save(); } @Inject  TreatmentsResource(Experiments experiments, Mappers mapper); @GET Iterable<TreatmentDto> getTreatments(@PathParam("experimentName") String experimentName); @GET @Path("/{treatmentName}") TreatmentDto getTreatment(@PathParam("experimentName") String experimentName,
                                     @PathParam("treatmentName") String treatmentName); @PUT Response addTreatment(@PathParam("experimentName") String experimentName,
                                 @Valid TreatmentDto treatmentDto); @DELETE @Path("/{treatmentName}") void removeTreatment(@PathParam("experimentName") String experimentName,
                                @PathParam("treatmentName") String treatmentName); @POST @Path("/{treatmentName}") void updateTreatment(@PathParam("experimentName") String experimentName,
                                @PathParam("treatmentName") String treatmentName,
                                @Valid UpdateTreatmentRequest request); @DELETE void clearTreatments(@PathParam("experimentName") String experimentName);  }
@Test public void testClearTreatments() { delete(TREATMENTS_ENDPOINT, EXPERIMENT_BAD) .assertStatus(Status.NOT_FOUND); assertNotNull(experiment(EXPERIMENT_1).getTreatment(EXP_1_TREATMENT_1)); assertNotNull(experiment(EXPERIMENT_1).getTreatment(EXP_1_TREATMENT_2)); assertNotNull(experiment(EXPERIMENT_1).getTreatment(EXP_1_TREATMENT_3)); delete(TREATMENTS_ENDPOINT, EXPERIMENT_1) .assertStatus(Status.NO_CONTENT); assertNull(experiment(EXPERIMENT_1).getTreatment(EXP_1_TREATMENT_1)); assertNull(experiment(EXPERIMENT_1).getTreatment(EXP_1_TREATMENT_2)); assertNull(experiment(EXPERIMENT_1).getTreatment(EXP_1_TREATMENT_3)); }