DataLegalEntityResource extends AbstractDocumentDataResource<LegalEntityDocument> { @POST public Response update(@Context UriInfo uriInfo, LegalEntityDocument request) { return super.update(uriInfo, request); } DataLegalEntityResource();  DataLegalEntityResource(final DataLegalEntityMasterResource legalEntitiesResource, final ObjectId legalEntityId); DataLegalEntityMasterResource getLegalEntitiesResource(); ObjectId getUrlId(); LegalEntityMaster 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, LegalEntityDocument 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<LegalEntityDocument> replacementDocuments); @PUT Response replaceVersions(List<LegalEntityDocument> replacementDocuments); @PUT @Path("all") Response replaceAllVersions(List<LegalEntityDocument> replacementDocuments);  }
@Test public void testUpdateLegalEntity() { final ManageableLegalEntity target = new MockLegalEntity("Test", ExternalIdBundle.of("A", "B"), Currency.GBP); final LegalEntityDocument request = new LegalEntityDocument(target); request.setUniqueId(OID.atLatestVersion()); final LegalEntityDocument result = new LegalEntityDocument(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()); }