TimelineDelegate { public void previous() { loadPrevious(timelineStateHolder.positionForPrevious(), new PreviousCallback(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 testPrevious_updatesPositionForPrevious() { final Timeline<TestItem> fakeTimeline = new FakeItemTimeline(NUM_ITEMS, TEST_MIN_POSITION, ANY_POSITION); delegate = new TimelineDelegate<>(fakeTimeline); assertNull(delegate.timelineStateHolder.positionForPrevious()); delegate.previous(); assertEquals(TEST_MIN_POSITION, delegate.timelineStateHolder.positionForPrevious()); }
@Test public void testPrevious_doesNotUpdatePositionAtEndOfTimeline() { final Timeline<TestItem> fakeEndTimeline = new FakeItemTimeline(ZERO_ITEMS, ANY_POSITION, ANY_POSITION); delegate = new TimelineDelegate<>(fakeEndTimeline); delegate.timelineStateHolder.setPreviousCursor(new TimelineCursor(null, null)); delegate.previous(); assertNull(delegate.timelineStateHolder.positionForPrevious()); }