MasterLegalEntitySource extends AbstractMasterSource<LegalEntity, LegalEntityDocument, LegalEntityMaster> implements LegalEntitySource { @SuppressWarnings({"unchecked", "rawtypes" }) @Override public Collection<LegalEntity> get(ExternalIdBundle bundle, VersionCorrection versionCorrection) { LegalEntitySearchRequest searchRequest = new LegalEntitySearchRequest(bundle); searchRequest.setVersionCorrection(versionCorrection); return (List) getMaster().search(searchRequest).getLegalEntities(); } 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 = DataNotFoundException.class) public void test_getLegalEntity_UniqueId_notFound() throws Exception { LegalEntityMaster mock = mock(LegalEntityMaster.class); when(mock.get(UID)).thenThrow(new DataNotFoundException("")); MasterLegalEntitySource test = new MasterLegalEntitySource(mock); try { test.get(UID); } finally { verify(mock, times(1)).get(UID); } }
@Test(expectedExceptions = DataNotFoundException.class) public void test_getLegalEntity_ObjectId_notFound() throws Exception { LegalEntityMaster mock = mock(LegalEntityMaster.class); when(mock.get(OID, VC)).thenThrow(new DataNotFoundException("")); MasterLegalEntitySource test = new MasterLegalEntitySource(mock); try { test.get(OID, VC); } finally { verify(mock, times(1)).get(OID, VC); } }