MasterSecuritySource extends AbstractMasterSource<Security, SecurityDocument, SecurityMaster> implements SecuritySource { @Override public Collection<Security> get(final ExternalIdBundle bundle) { return get(bundle, VersionCorrection.LATEST); } MasterSecuritySource(final SecurityMaster master); @Override Collection<Security> get(final ExternalIdBundle bundle); @Override Collection<Security> get(ExternalIdBundle bundle, VersionCorrection versionCorrection); @Override Map<ExternalIdBundle, Collection<Security>> getAll(final Collection<ExternalIdBundle> bundle, final VersionCorrection versionCorrection); @Override ManageableSecurity getSingle(final ExternalIdBundle bundle); @Override ManageableSecurity getSingle(ExternalIdBundle bundle, VersionCorrection versionCorrection); @Override Map<ExternalIdBundle, Security> getSingle(final Collection<ExternalIdBundle> bundle, final VersionCorrection versionCorrection); SecuritySearchResult search(final SecuritySearchRequest request); @Override ChangeManager changeManager();  }
@Test(expectedExceptions = DataNotFoundException.class) public void test_getSecurity_UniqueId_notFound() throws Exception { SecurityMaster mock = mock(SecurityMaster.class); when(mock.get(UID)).thenThrow(new DataNotFoundException("")); MasterSecuritySource test = new MasterSecuritySource(mock); try { test.get(UID); } finally { verify(mock, times(1)).get(UID); } }
@Test(expectedExceptions = DataNotFoundException.class) public void test_getSecurity_ObjectId_notFound() throws Exception { SecurityMaster mock = mock(SecurityMaster.class); when(mock.get(OID, VC)).thenThrow(new DataNotFoundException("")); MasterSecuritySource test = new MasterSecuritySource(mock); try { test.get(OID, VC); } finally { verify(mock, times(1)).get(OID, VC); } }