TimelineDelegate { public void refresh(Callback<TimelineResult<T>> developerCb) { timelineStateHolder.resetCursors(); loadNext(timelineStateHolder.positionForNext(), new RefreshCallback(developerCb, timelineStateHolder)); } TimelineDelegate(Timeline<T> timeline);   TimelineDelegate(Timeline<T> timeline, DataSetObservable observable, List<T> items); void refresh(Callback<TimelineResult<T>> developerCb); void next(Callback<TimelineResult<T>> developerCb); void previous(); int getCount(); Timeline getTimeline(); T getItem(int position); long getItemId(int position); void setItemById(T item); void registerDataSetObserver(DataSetObserver observer); void unregisterDataSetObserver(DataSetObserver observer); void notifyDataSetChanged(); void notifyDataSetInvalidated();  }
@Test public void testRefresh_resetsTimelineCursors() { delegate = new TimelineDelegate<>(mockTimeline); delegate.timelineStateHolder.setNextCursor(new TimelineCursor(ANY_POSITION, ANY_POSITION)); delegate.timelineStateHolder.setPreviousCursor(new TimelineCursor(ANY_POSITION, ANY_POSITION)); delegate.refresh(null); assertNull(delegate.timelineStateHolder.positionForNext()); assertNull(delegate.timelineStateHolder.positionForPrevious()); }
@Test public void testRefresh_replacesItems() { final Timeline<TestItem> fakeTimeline = new FakeItemTimeline(NUM_ITEMS, ANY_POSITION, ANY_POSITION); delegate = new TimelineDelegate<>(fakeTimeline, mockObservable, testItems); assertEquals(testItems, delegate.itemList); delegate.refresh(null); assertEquals(NUM_ITEMS, delegate.itemList.size()); verify(mockObservable).notifyChanged(); }