DataPortfolioResource extends AbstractDocumentDataResource<PortfolioDocument> { @POST public Response update(@Context UriInfo uriInfo, PortfolioDocument request) { return super.update(uriInfo, request); } DataPortfolioResource();  DataPortfolioResource(final DataPortfolioMasterResource portfoliosResource, final ObjectId portfolioId); DataPortfolioMasterResource getPortfoliosResource(); ObjectId getUrlId(); PortfolioMaster getMaster(); @GET @Path("versions") Response history(@Context UriInfo uriInfo); @GET Response get(@QueryParam("versionAsOf") String versionAsOf, @QueryParam("correctedTo") String correctedTo); @POST Response update(@Context UriInfo uriInfo, PortfolioDocument request); @DELETE void remove(); @GET @Path("versions/{versionId}") Response getVersioned(@PathParam("versionId") String versionId); @PUT @Path("versions/{versionId}") Response replaceVersion(@PathParam("versionId") String versionId, List<PortfolioDocument> replacementDocuments); @PUT Response replaceVersions(List<PortfolioDocument> replacementDocuments); @PUT @Path("all") Response replaceAllVersions(List<PortfolioDocument> replacementDocuments);  }
@Test public void testUpdatePortfolio() { final ManageablePortfolio target = new ManageablePortfolio("Portfolio"); final PortfolioDocument request = new PortfolioDocument(target); request.setUniqueId(OID.atVersion("1")); final PortfolioDocument result = new PortfolioDocument(target); result.setUniqueId(OID.atVersion("1")); when(_underlying.update(same(request))).thenReturn(result); Response test = _resource.update(_uriInfo, request); assertEquals(Status.CREATED.getStatusCode(), test.getStatus()); assertSame(result, test.getEntity()); }