コード例 #1
0
 // 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();
 }
コード例 #2
0
 @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);
 }
コード例 #3
0
 @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");
   }
 }