ExperimentsResource extends BaseResource { @GET public Iterable<ExperimentDto> getExperiments(@QueryParam("filter") String filterValue, @QueryParam("offset") Integer offset, @QueryParam("limit") Integer limit, @QueryParam("sort") String sort) { return mapper.toDto( experiments.find( Filter .criteria() .filter(filterValue) .offset(offset) .limit(limit) .ordering(Ordering.parse(sort)) .build() ), 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 testGetExperiments() { final Iterable<ExperimentDto> expected = MAPPER.toDto(EXPERIMENTS.find(), ExperimentDto.class); final Iterable<ExperimentDto> actual = get(EXPERIMENTS_ENDPOINT) .assertStatus(Status.OK) .result(iterable(ExperimentDto.class)); assertEquals(expected, actual); }