TreatmentOverridesResource extends BaseResource { @GET @Path("/{overrideName}") public TreatmentOverrideDto getOverride(@PathParam("experimentName") String experimentName, @PathParam("overrideName") String overrideName) { return mapper.toDto( ensureExists( ensureExists( experiments.get(experimentName) ).getOverride(overrideName) ), TreatmentOverrideDto.class ); } @Inject  TreatmentOverridesResource(Experiments experiments, Mappers mapper); @GET @Path("/{overrideName}") TreatmentOverrideDto getOverride(@PathParam("experimentName") String experimentName,
                                            @PathParam("overrideName") String overrideName); @GET Iterable<TreatmentOverrideDto> getOverrides(@PathParam("experimentName") String experimentName); @PUT Response addOverride(@PathParam("experimentName") String experimentName,
                                @Valid TreatmentOverrideRequest request); @DELETE void clearOverrides(@PathParam("experimentName") String experimentName); @DELETE @Path("/{overrideName}") void removeOverride(@PathParam("experimentName") String experimentName,
                               @PathParam("overrideName") String overrideName);  }
@Test public void testGetOverride() { get(ENDPOINT_OVERRIDE, EXPERIMENT_BAD, EXP_1_OVERRIDE) .assertStatus(Status.NOT_FOUND); get(ENDPOINT_OVERRIDE, EXPERIMENT_1, OVERRIDE_BAD) .assertStatus(Status.NOT_FOUND); final TreatmentOverrideDto expected = MAPPER.toDto( experiment(EXPERIMENT_1).getOverride(EXP_1_OVERRIDE), TreatmentOverrideDto.class ); final TreatmentOverrideDto actual = get(ENDPOINT_OVERRIDE, EXPERIMENT_1, EXP_1_OVERRIDE) .assertStatus(Status.OK) .result(TreatmentOverrideDto.class); assertEquals(expected, actual); }