@Test public void givenReader_ShouldInvokeGetRecords() throws IOException { OutputCache<String> cache = new OutputCache<>(readerSpy, 100L); Awaitility.await() .atMost(90, TimeUnit.MILLISECONDS) .pollInterval(5, TimeUnit.MILLISECONDS) .untilAsserted(() -> { Assert.assertThat(cache.getRecords(), Matchers.hasSize(1)); }); Mockito.verify(readerSpy).getRecords(); }
@Override public List<T> getRecords() { return new LinkedList<>(records); }
OutputCache implements Reader<T> { @Override public List<T> getRecords() { return new LinkedList<>(records); } }
OutputCache implements Reader<T> { @Override public List<T> getRecords() { return new LinkedList<>(records); } OutputCache(Reader<T> reader, Long refreshInterval);  OutputCache(Reader<T> reader, Long refreshInterval, Consumer<IOException> exceptionHandler); }
OutputCache implements Reader<T> { @Override public List<T> getRecords() { return new LinkedList<>(records); } OutputCache(Reader<T> reader, Long refreshInterval);  OutputCache(Reader<T> reader, Long refreshInterval, Consumer<IOException> exceptionHandler); @Override List<T> getRecords(); @Override void setConfiguration(ReaderConfiguration configuration); void refresh(); void cancel(); }
OutputCache implements Reader<T> { @Override public List<T> getRecords() { return new LinkedList<>(records); } OutputCache(Reader<T> reader, Long refreshInterval);  OutputCache(Reader<T> reader, Long refreshInterval, Consumer<IOException> exceptionHandler); @Override List<T> getRecords(); @Override void setConfiguration(ReaderConfiguration configuration); void refresh(); void cancel();  }