// ------------------------------------------------------------------------- public void test_getExchange_ObjectId_found() throws Exception { ExchangeMaster mock = mock(ExchangeMaster.class); ExchangeDocument doc = new ExchangeDocument(example()); when(mock.get(OID, VC)).thenReturn(doc); MasterExchangeSource test = new MasterExchangeSource(mock, VC); Exchange testResult = test.get(OID, VC); verify(mock, times(1)).get(OID, VC); assertEquals(example(), testResult); }
@Test(expectedExceptions = DataNotFoundException.class) public void test_getExchange_UniqueId_notFound() throws Exception { ExchangeMaster mock = mock(ExchangeMaster.class); when(mock.get(OID, VC)).thenThrow(new DataNotFoundException("")); MasterExchangeSource test = new MasterExchangeSource(mock, VC); try { test.get(UID); } finally { verify(mock, times(1)).get(OID, VC); } }