ExperimentsResource extends BaseResource { @GET @Path("/{experimentName}") public ExperimentDto getExperiment(@PathParam("experimentName") String experimentName) { return mapper.toDto( ensureExists(experiments.get(experimentName)), ExperimentDto.class ); } @Inject  ExperimentsResource(Experiments experiments, Mappers mapper); @GET Iterable<ExperimentDto> getExperiments(@QueryParam("filter") String filterValue,
                                                  @QueryParam("offset") Integer offset,
                                                  @QueryParam("limit") Integer limit,
                                                  @QueryParam("sort") String sort); @PUT Response addExperiment(@Valid CreateExperimentRequest request); @POST @Path("/{experimentName}") void updateExperiment(@PathParam("experimentName") String experimentName,
                                 @Valid UpdateExperimentRequest request); @GET @Path("/{experimentName}") ExperimentDto getExperiment(@PathParam("experimentName") String experimentName); @DELETE @Path("/{experimentName}") void removeExperiment(@PathParam("experimentName") String experimentName);  }
@Test public void testGetExperiment() { get(EXPERIMENT_ENDPOINT, EXPERIMENT_BAD) .assertStatus(Status.NOT_FOUND); final ExperimentDto expected = MAPPER.toDto(experiment(EXPERIMENT_1), ExperimentDto.class); final ExperimentDto actual = get(EXPERIMENT_ENDPOINT, EXPERIMENT_1) .assertStatus(Status.OK) .result(ExperimentDto.class); assertEquals(expected, actual); }