MasterExchangeSource extends AbstractMasterSource<Exchange, ExchangeDocument, ExchangeMaster> implements ExchangeSource { @SuppressWarnings({"unchecked", "rawtypes" }) @Override public Collection<Exchange> get(ExternalIdBundle bundle, VersionCorrection versionCorrection) { ExchangeSearchRequest searchRequest = new ExchangeSearchRequest(bundle); searchRequest.setVersionCorrection(versionCorrection); return (List) getMaster().search(searchRequest).getExchanges(); } MasterExchangeSource(final ExchangeMaster master); @SuppressWarnings({"unchecked", "rawtypes" }) @Override Collection<Exchange> get(ExternalIdBundle bundle, VersionCorrection versionCorrection); @Override ManageableExchange getSingle(ExternalId identifier); @Override ManageableExchange getSingle(ExternalIdBundle identifiers); @Override Map<ExternalIdBundle, Collection<Exchange>> getAll(Collection<ExternalIdBundle> bundles, VersionCorrection versionCorrection); @Override Collection<Exchange> get(ExternalIdBundle bundle); @Override ManageableExchange getSingle(ExternalIdBundle bundle, VersionCorrection versionCorrection); @Override Map<ExternalIdBundle, Exchange> getSingle(Collection<ExternalIdBundle> bundles, VersionCorrection versionCorrection);  }
@Test(expectedExceptions = DataNotFoundException.class) public void test_getExchange_UniqueId_notFound() throws Exception { ExchangeMaster mock = mock(ExchangeMaster.class); when(mock.get(UID)).thenThrow(new DataNotFoundException("")); MasterExchangeSource test = new MasterExchangeSource(mock); try { test.get(UID); } finally { verify(mock, times(1)).get(UID); } }
@Test(expectedExceptions = DataNotFoundException.class) public void test_getExchange_ObjectId_notFound() throws Exception { ExchangeMaster mock = mock(ExchangeMaster.class); when(mock.get(OID, VC)).thenThrow(new DataNotFoundException("")); MasterExchangeSource test = new MasterExchangeSource(mock); try { test.get(OID, VC); } finally { verify(mock, times(1)).get(OID, VC); } }