@Test public void doWork_whenNoTrackersReturned_shouldNotMakeTrackingRequests() { List<VastTracker> testTrackers = new ArrayList<VastTracker>(); when(mockVastVideoViewController.getUntriggeredTrackersBefore(eq(3000), eq(4000))) .thenReturn(testTrackers); when(mockVastVideoViewController.getCurrentPosition()).thenReturn(3000); when(mockVastVideoViewController.getDuration()).thenReturn(4000); when(mockVastVideoViewController.getContext()).thenReturn(mockContext); subject.doWork(); verify(mockVastVideoViewController).getUntriggeredTrackersBefore(eq(3000), eq(4000)); verify(mockVastVideoViewController).getCurrentPosition(); verify(mockVastVideoViewController).getDuration(); verifyNoMoreInteractions(mockVastVideoViewController, mockRequestQueue); }
@Override public void doWork() { int videoLength = mVideoViewController.getDuration(); int currentPosition = mVideoViewController.getCurrentPosition(); if (videoLength > 0) { final List<VastTracker> trackersToTrack = mVideoViewController.getUntriggeredTrackersBefore(currentPosition, videoLength); if (!trackersToTrack.isEmpty()) { final List<String> trackUrls = new ArrayList<String>(); for (VastTracker tracker : trackersToTrack) { trackUrls.add(tracker.getTrackingUrl()); tracker.setTracked(); } TrackingRequest.makeTrackingHttpRequest(trackUrls, mVideoViewController.getContext()); } } }
VastVideoViewProgressRunnable extends RepeatingHandlerRunnable { @Override public void doWork() { int videoLength = mVideoViewController.getDuration(); int currentPosition = mVideoViewController.getCurrentPosition(); if (videoLength > 0) { final List<VastTracker> trackersToTrack = mVideoViewController.getUntriggeredTrackersBefore(currentPosition, videoLength); if (!trackersToTrack.isEmpty()) { final List<String> trackUrls = new ArrayList<String>(); for (VastTracker tracker : trackersToTrack) { trackUrls.add(tracker.getTrackingUrl()); tracker.setTracked(); } TrackingRequest.makeTrackingHttpRequest(trackUrls, mVideoViewController.getContext()); } } } }
VastVideoViewProgressRunnable extends RepeatingHandlerRunnable { @Override public void doWork() { int videoLength = mVideoViewController.getDuration(); int currentPosition = mVideoViewController.getCurrentPosition(); if (videoLength > 0) { final List<VastTracker> trackersToTrack = mVideoViewController.getUntriggeredTrackersBefore(currentPosition, videoLength); if (!trackersToTrack.isEmpty()) { final List<String> trackUrls = new ArrayList<String>(); for (VastTracker tracker : trackersToTrack) { trackUrls.add(tracker.getTrackingUrl()); tracker.setTracked(); } TrackingRequest.makeTrackingHttpRequest(trackUrls, mVideoViewController.getContext()); } } } VastVideoViewProgressRunnable(@NonNull VastVideoViewController videoViewController,
            @NonNull Handler handler); }
VastVideoViewProgressRunnable extends RepeatingHandlerRunnable { @Override public void doWork() { int videoLength = mVideoViewController.getDuration(); int currentPosition = mVideoViewController.getCurrentPosition(); if (videoLength > 0) { final List<VastTracker> trackersToTrack = mVideoViewController.getUntriggeredTrackersBefore(currentPosition, videoLength); if (!trackersToTrack.isEmpty()) { final List<String> trackUrls = new ArrayList<String>(); for (VastTracker tracker : trackersToTrack) { trackUrls.add(tracker.getTrackingUrl()); tracker.setTracked(); } TrackingRequest.makeTrackingHttpRequest(trackUrls, mVideoViewController.getContext()); } } } VastVideoViewProgressRunnable(@NonNull VastVideoViewController videoViewController,
            @NonNull Handler handler); @Override void doWork(); }
VastVideoViewProgressRunnable extends RepeatingHandlerRunnable { @Override public void doWork() { int videoLength = mVideoViewController.getDuration(); int currentPosition = mVideoViewController.getCurrentPosition(); if (videoLength > 0) { final List<VastTracker> trackersToTrack = mVideoViewController.getUntriggeredTrackersBefore(currentPosition, videoLength); if (!trackersToTrack.isEmpty()) { final List<String> trackUrls = new ArrayList<String>(); for (VastTracker tracker : trackersToTrack) { trackUrls.add(tracker.getTrackingUrl()); tracker.setTracked(); } TrackingRequest.makeTrackingHttpRequest(trackUrls, mVideoViewController.getContext()); } } } VastVideoViewProgressRunnable(@NonNull VastVideoViewController videoViewController,
            @NonNull Handler handler); @Override void doWork();  }