DataHolidayMasterResource extends AbstractDataResource { @POST @Path("holidays") public Response add(@Context UriInfo uriInfo, HolidayDocument request) { HolidayDocument result = getHolidayMaster().add(request); URI createdUri = (new DataHolidayResource()).uriVersion(uriInfo.getBaseUri(), result.getUniqueId()); return responseCreatedObject(createdUri, result); } DataHolidayMasterResource(final HolidayMaster holidayMaster); HolidayMaster getHolidayMaster(); @GET Response getHateaos(@Context UriInfo uriInfo); @GET @Path("metaData") Response metaData(@Context UriInfo uriInfo); @POST @Path("holidaySearches") Response search(HolidaySearchRequest request); @POST @Path("holidays") Response add(@Context UriInfo uriInfo, HolidayDocument request); @Path("holidays/{holidayId}") DataHolidayResource findHoliday(@PathParam("holidayId") String idStr); static URI uriMetaData(URI baseUri, HolidayMetaDataRequest request); static URI uriSearch(URI baseUri); static URI uriAdd(URI baseUri);  }
@Test public void testAddHoliday() { final ManageableHoliday target = new ManageableHoliday(Currency.GBP, new ArrayList<LocalDate>()); final HolidayDocument request = new HolidayDocument(target); final HolidayDocument result = new HolidayDocument(target); result.setUniqueId(UID); when(_underlying.add(same(request))).thenReturn(result); Response test = _resource.add(_uriInfo, request); assertEquals(Status.CREATED.getStatusCode(), test.getStatus()); assertSame(result, test.getEntity()); }