AllocationsResource extends BaseResource { @GET public Iterable<AllocationDto> getAllocations(@PathParam("experimentName") String experimentName) { return mapper.toDto( ensureExists(experiments.get(experimentName)).getAllocations(), AllocationDto.class ); } @Inject  AllocationsResource(Experiments experiments, Mappers mapper); @GET Iterable<AllocationDto> getAllocations(@PathParam("experimentName") String experimentName); @POST void updateAllocations(@PathParam("experimentName") String experimentName,
                                  @Valid List<AllocationRequest> requests); @DELETE void clearAllocations(@PathParam("experimentName") String experimentName);  }
@Test public void testGetAllocations() { get(ALLOCATIONS_ENDPOINT, EXPERIMENT_BAD) .assertStatus(Status.NOT_FOUND); final Iterable<AllocationDto> expected = MAPPER.toDto(experiment(EXPERIMENT_1).getAllocations(), AllocationDto.class); final Iterable<AllocationDto> actual = get(ALLOCATIONS_ENDPOINT, EXPERIMENT_1) .assertStatus(Status.OK) .result(iterable(AllocationDto.class)); assertEquals(expected, actual); }