DataLegalEntityMasterResource extends AbstractDataResource { @POST @Path("legalentities") public Response add(@Context UriInfo uriInfo, LegalEntityDocument request) { LegalEntityDocument result = getLegalEntityMaster().add(request); URI createdUri = (new com.opengamma.master.legalentity.impl.DataLegalEntityResource()).uriVersion(uriInfo.getBaseUri(), result.getUniqueId()); return responseCreatedObject(createdUri, result); } DataLegalEntityMasterResource(final LegalEntityMaster legalEntityMaster); LegalEntityMaster getLegalEntityMaster(); @GET Response getHateaos(@Context UriInfo uriInfo); @HEAD @Path("legalentities") Response status(); @GET @Path("metaData") Response metaData(@Context UriInfo uriInfo); @POST @Path("legalentitiesearches") Response search(LegalEntitySearchRequest request); @POST @Path("legalentities") Response add(@Context UriInfo uriInfo, LegalEntityDocument request); @Path("legalentities/{legalEntityId}") com.opengamma.master.legalentity.impl.DataLegalEntityResource findLegalEntity(@PathParam("legalEntityId") String idStr); static URI uriMetaData(URI baseUri, LegalEntityMetaDataRequest request); static URI uriSearch(URI baseUri); static URI uriAdd(URI baseUri);  }
@Test public void testAddLegalEntity() { final ManageableLegalEntity target = new MockLegalEntity("Test", ExternalIdBundle.of("A", "B"), Currency.GBP); final LegalEntityDocument request = new LegalEntityDocument(target); final LegalEntityDocument result = new LegalEntityDocument(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()); }