final ExchangeSource underlying = Mockito.mock(ExchangeSource.class);
Mockito.when(underlying.getSingle(Mockito.<ExternalId>anyObject())).thenAnswer(new Answer<Exchange>() {
@Override
public Exchange answer(InvocationOnMock invocation) throws Throwable {
getCount.incrementAndGet();
SimpleExchange simpleExchange = new SimpleExchange();
simpleExchange.setUniqueId(UniqueId.of("Test", "Foo", "0"));
simpleExchange.setExternalIdBundle(ExternalIdBundle.of((ExternalId) invocation.getArguments()[0]));
return simpleExchange;
}
});
EHCachingExchangeSource source = new EHCachingExchangeSource(underlying, _cacheManager);
assertEquals(0, getCount.get());