### Question:
SamplesResource { @GET @Timed @Path("/{resource}") public Collection<Collection<SampleDTO>> getSamples(@PathParam("resource") Resource resource, @QueryParam("start") Optional<TimestampParam> start, @QueryParam("end") Optional<TimestampParam> end, @QueryParam("context") Optional<String> contextId) { Optional<Timestamp> lower = Transform.toTimestamp(start); Optional<Timestamp> upper = Transform.toTimestamp(end); Context context = contextId.isPresent() ? new Context(contextId.get()) : Context.DEFAULT_CONTEXT; return Transform.sampleDTOs(m_sampleRepository.select(context, resource, lower, upper)); } SamplesResource(SampleRepository sampleRepository,
                           Indexer indexer); @POST @Timed Response writeSamples(Collection<SampleDTO> samples); @GET @Timed @Path("/{resource}") Collection<Collection<SampleDTO>> getSamples(@PathParam("resource") Resource resource,
            @QueryParam("start") Optional<TimestampParam> start, @QueryParam("end") Optional<TimestampParam> end,
            @QueryParam("context") Optional<String> contextId); @DELETE @Timed @Path("/{resource}") void deleteSamples(@PathParam("resource") Resource resource,
                              @QueryParam("context") Optional<String> contextId);  }### Answer:
@Test public void testGetSamples() { final Results<Sample> results = new Results<>(); when( m_repository.select( eq(Context.DEFAULT_CONTEXT), eq(new Resource("localhost")), eq(Optional.of(Timestamp.fromEpochSeconds(900000000))), eq(Optional.of(Timestamp.fromEpochSeconds(900003600)))) ).thenReturn(results); assertThat( m_resource.getSamples( new Resource("localhost"), Optional.of(new TimestampParam("1998-07-09T11:00:00-0500")), Optional.of(new TimestampParam("1998-07-09T12:00:00-0500")), Optional.<String>absent()), CoreMatchers.instanceOf(Collection.class)); }