@Test public void fetchItemWithExceptionOnStoreTop() throws IOException { IOException cause = new IOException(); doThrow( cause ).when( sessionStorage ).storeTop( any( Item.class ) ); Throwable actual = thrownBy( () -> timeline.fetchItems() ); assertNotNull( actual ); assertTrue( actual instanceof IllegalStateException ); assertSame( cause, actual.getCause() ); assertEquals( Timeline.ERROR_STORE_TOP, actual.getMessage() ); }
public void fetchItems() { int restoreOffset = restoreIfNeeded(); items.addAll( itemProvider.fetchItems( getOldest(), getFetchCount() + restoreOffset ) ); storeTopItem(); }
Timeline { public void fetchItems() { int restoreOffset = restoreIfNeeded(); items.addAll( itemProvider.fetchItems( getOldest(), getFetchCount() + restoreOffset ) ); storeTopItem(); } }
Timeline { public void fetchItems() { int restoreOffset = restoreIfNeeded(); items.addAll( itemProvider.fetchItems( getOldest(), getFetchCount() + restoreOffset ) ); storeTopItem(); } Timeline( ItemProvider itemProvider, SessionStorage sessionStorage  ); }
Timeline { public void fetchItems() { int restoreOffset = restoreIfNeeded(); items.addAll( itemProvider.fetchItems( getOldest(), getFetchCount() + restoreOffset ) ); storeTopItem(); } Timeline( ItemProvider itemProvider, SessionStorage sessionStorage  ); void setFetchCount( int fetchCount ); int getFetchCount(); List<Item> getItems(); void fetchItems(); }
Timeline { public void fetchItems() { int restoreOffset = restoreIfNeeded(); items.addAll( itemProvider.fetchItems( getOldest(), getFetchCount() + restoreOffset ) ); storeTopItem(); } Timeline( ItemProvider itemProvider, SessionStorage sessionStorage  ); void setFetchCount( int fetchCount ); int getFetchCount(); List<Item> getItems(); void fetchItems(); static final int FETCH_COUNT_LOWER_BOUND; static final int FETCH_COUNT_UPPER_BOUND; }