@Test public void testGetTreatment() { get(TREATMENT_ENDPOINT, EXPERIMENT_BAD, EXP_1_TREATMENT_1) .assertStatus(Status.NOT_FOUND); get(TREATMENT_ENDPOINT, EXPERIMENT_1, TREATMENT_BAD) .assertStatus(Status.NOT_FOUND); final TreatmentDto expected = MAPPER.toDto(experiment(EXPERIMENT_1).getTreatment(EXP_1_TREATMENT_1), TreatmentDto.class); final TreatmentDto actual = get(TREATMENT_ENDPOINT, EXPERIMENT_1, EXP_1_TREATMENT_1) .assertStatus(Status.OK) .result(TreatmentDto.class); assertEquals(expected, actual); }
@GET @Path("/{treatmentName}") public TreatmentDto getTreatment(@PathParam("experimentName") String experimentName, @PathParam("treatmentName") String treatmentName) { return mapper.toDto( ensureExists( ensureExists(experiments.get(experimentName)).getTreatment(treatmentName) ), TreatmentDto.class ); }
TreatmentsResource extends BaseResource { @GET @Path("/{treatmentName}") public TreatmentDto getTreatment(@PathParam("experimentName") String experimentName, @PathParam("treatmentName") String treatmentName) { return mapper.toDto( ensureExists( ensureExists(experiments.get(experimentName)).getTreatment(treatmentName) ), TreatmentDto.class ); } }
TreatmentsResource extends BaseResource { @GET @Path("/{treatmentName}") public TreatmentDto getTreatment(@PathParam("experimentName") String experimentName, @PathParam("treatmentName") String treatmentName) { return mapper.toDto( ensureExists( ensureExists(experiments.get(experimentName)).getTreatment(treatmentName) ), TreatmentDto.class ); } @Inject  TreatmentsResource(Experiments experiments, Mappers mapper); }
TreatmentsResource extends BaseResource { @GET @Path("/{treatmentName}") public TreatmentDto getTreatment(@PathParam("experimentName") String experimentName, @PathParam("treatmentName") String treatmentName) { return mapper.toDto( ensureExists( ensureExists(experiments.get(experimentName)).getTreatment(treatmentName) ), TreatmentDto.class ); } @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); }
TreatmentsResource extends BaseResource { @GET @Path("/{treatmentName}") public TreatmentDto getTreatment(@PathParam("experimentName") String experimentName, @PathParam("treatmentName") String treatmentName) { return mapper.toDto( ensureExists( ensureExists(experiments.get(experimentName)).getTreatment(treatmentName) ), TreatmentDto.class ); } @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);  }