DataTradeResource extends AbstractDataResource { @GET @Path("versions/{versionId}") public Response getVersioned(@PathParam("versionId") String versionId) { UniqueId tradeId = getUrlTradeId().atVersion(versionId); ManageableTrade result = getPositionMaster().getTrade(tradeId); return responseOkObject(result); } DataTradeResource(final DataPositionMasterResource parentResource, final ObjectId positionId); DataPositionMasterResource getParentResource(); ObjectId getUrlTradeId(); PositionMaster getPositionMaster(); @GET Response get(); @GET @Path("versions/{versionId}") Response getVersioned(@PathParam("versionId") String versionId); static URI uri(URI baseUri, ObjectIdentifiable objectId, VersionCorrection vc); static URI uriVersion(URI baseUri, UniqueId uniqueId);  }
@Test public void testGetTradeVersion() { final ManageablePosition target = new ManageablePosition(); target.setQuantity(BigDecimal.ONE); final ManageableTrade result = new ManageableTrade(); result.setQuantity(BigDecimal.ONE); when(_underlying.getTrade(OID.atVersion("6"))).thenReturn(result); Response test = _resource.getVersioned("6"); assertEquals(Status.OK.getStatusCode(), test.getStatus()); assertSame(result, test.getEntity()); }