// should unconditionally set requestInFlight to false @Test public void testDefaultCallback_failureCallsFinishTimelineRequest() { delegate = new TimelineDelegate<>(mockTimeline); final TimelineStateHolder mockHolder = mock(TimelineStateHolder.class); final TimelineDelegate.DefaultCallback cb = delegate.new DefaultCallback(null, mockHolder); cb.failure((TwitterException) null); verify(mockHolder).finishTimelineRequest(); }
@Test public void testDefaultCallback_failureCallsDeveloperCallback() { final Callback<TimelineResult<TestItem>> developerCb = mock(Callback.class); delegate = new TimelineDelegate<>(mockTimeline); final TimelineDelegate.DefaultCallback cb = delegate.new DefaultCallback(developerCb, delegate.timelineStateHolder); cb.failure(TEST_TWITTER_EXCEPTION); verify(developerCb).failure(TEST_TWITTER_EXCEPTION); }
@Test public void testDefaultCallback_failureHandlesNullDeveloperCallback() { delegate = new TimelineDelegate<>(mockTimeline); final TimelineDelegate.DefaultCallback cb = delegate.new DefaultCallback(null, delegate.timelineStateHolder); try { cb.failure(TEST_TWITTER_EXCEPTION); } catch (NullPointerException e) { fail("Should have handled null callback"); } }