MasterLegalEntitySource extends AbstractMasterSource<LegalEntity, LegalEntityDocument, LegalEntityMaster> implements LegalEntitySource { @Override public ManageableLegalEntity getSingle(ExternalId identifier) { return getSingle(identifier.toBundle()); } MasterLegalEntitySource(final LegalEntityMaster master); @Override ChangeManager changeManager(); @SuppressWarnings({"unchecked", "rawtypes" }) @Override Collection<LegalEntity> get(ExternalIdBundle bundle, VersionCorrection versionCorrection); @Override ManageableLegalEntity getSingle(ExternalId identifier); @Override ManageableLegalEntity getSingle(ExternalIdBundle identifiers); @Override Map<ExternalIdBundle, Collection<LegalEntity>> getAll(Collection<ExternalIdBundle> bundles, VersionCorrection versionCorrection); @Override Collection<LegalEntity> get(ExternalIdBundle bundle); @Override ManageableLegalEntity getSingle(ExternalIdBundle bundle, VersionCorrection versionCorrection); @Override Map<ExternalIdBundle, LegalEntity> getSingle(Collection<ExternalIdBundle> bundles, VersionCorrection versionCorrection);  }
@Test(expectedExceptions = com.opengamma.DataNotFoundException.class) public void test_getLegalEntity_not_found() throws Exception { LegalEntityMaster mock = mock(LegalEntityMaster.class); ArgumentCaptor<LegalEntitySearchRequest> searchRequest = ArgumentCaptor.forClass(LegalEntitySearchRequest.class); LegalEntitySearchResult searchResult = mock(LegalEntitySearchResult.class); when(mock.search(searchRequest.capture())).thenReturn(searchResult); MasterLegalEntitySource test = new MasterLegalEntitySource(mock); LegalEntity testResult = test.getSingle(ExternalId.of("b", "a")); assertEquals(example(), testResult); }