DataMarketDataSnapshotMasterResource extends AbstractDataResource { @POST @Path("snapshots") public Response add(@Context UriInfo uriInfo, MarketDataSnapshotDocument request) { MarketDataSnapshotDocument result = getMarketDataSnapshotMaster().add(request); URI createdUri = (new DataMarketDataSnapshotResource()).uriVersion(uriInfo.getBaseUri(), result.getUniqueId()); return responseCreatedObject(createdUri, result); } DataMarketDataSnapshotMasterResource(final MarketDataSnapshotMaster snapshotMaster); MarketDataSnapshotMaster getMarketDataSnapshotMaster(); @GET Response getHateaos(@Context UriInfo uriInfo); @HEAD @Path("snapshots") Response status(); @POST @Path("snapshotSearches") Response search(MarketDataSnapshotSearchRequest request); @POST @Path("snapshots") Response add(@Context UriInfo uriInfo, MarketDataSnapshotDocument request); @Path("snapshots/{snapshotId}") DataMarketDataSnapshotResource findMarketDataSnapshot(@PathParam("snapshotId") String idStr); @Path("snapshots/changeManager") DataChangeManagerResource getChangeManager(); static URI uriSearch(URI baseUri); static URI uriAdd(URI baseUri);  }
@Test public void testAddMarketDataSnapshot() { final ManageableMarketDataSnapshot target = new ManageableMarketDataSnapshot(); target.setBasisViewName("Basis"); final MarketDataSnapshotDocument request = new MarketDataSnapshotDocument(target); final MarketDataSnapshotDocument result = new MarketDataSnapshotDocument(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()); }