MasterConventionSource extends AbstractMasterSource<Convention, ConventionDocument, ConventionMaster> implements ConventionSource { @Override public Collection<Convention> get(ExternalIdBundle bundle) { ArgumentChecker.notNull(bundle, "bundle"); return get(bundle, VersionCorrection.LATEST); } MasterConventionSource(final ConventionMaster master); @Override Collection<Convention> get(ExternalIdBundle bundle); @Override Collection<Convention> get(ExternalIdBundle bundle, VersionCorrection versionCorrection); @Override Map<ExternalIdBundle, Collection<Convention>> getAll(final Collection<ExternalIdBundle> bundle, final VersionCorrection versionCorrection); @Override Convention getSingle(ExternalIdBundle bundle); @Override ManageableConvention getSingle(ExternalIdBundle bundle, VersionCorrection versionCorrection); @Override Map<ExternalIdBundle, Convention> getSingle(final Collection<ExternalIdBundle> bundles, final VersionCorrection versionCorrection); @Override T get(UniqueId uniqueId, Class<T> type); @Override T get(ObjectId objectId, VersionCorrection versionCorrection, Class<T> type); @Override Convention getSingle(ExternalId externalId); @Override T getSingle(ExternalId externalId, Class<T> type); @Override T getSingle(ExternalIdBundle bundle, Class<T> type); @Override T getSingle(ExternalIdBundle bundle, VersionCorrection versionCorrection, Class<T> type); ConventionSearchResult search(final ConventionSearchRequest request); @Override ChangeManager changeManager();  }
@Test(expectedExceptions = DataNotFoundException.class) public void test_getConvention_UniqueId_notFound() throws Exception { ConventionMaster mock = mock(ConventionMaster.class); when(mock.get(UID)).thenThrow(new DataNotFoundException("")); MasterConventionSource test = new MasterConventionSource(mock); try { test.get(UID); } finally { verify(mock, times(1)).get(UID); } }
@Test(expectedExceptions = DataNotFoundException.class) public void test_getConvention_ObjectId_notFound() throws Exception { ConventionMaster mock = mock(ConventionMaster.class); when(mock.get(OID, VC)).thenThrow(new DataNotFoundException("")); MasterConventionSource test = new MasterConventionSource(mock); try { test.get(OID, VC); } finally { verify(mock, times(1)).get(OID, VC); } }