@Test public void testReprocessFailedQueue() throws SQLException { Context context = mock(Context.class); List<OpenURLTracker> trackers = new ArrayList<>(); OpenURLTracker tracker1 = mock(OpenURLTracker.class); OpenURLTracker tracker2 = mock(OpenURLTracker.class); OpenURLTracker tracker3 = mock(OpenURLTracker.class); trackers.add(tracker1); trackers.add(tracker2); trackers.add(tracker3); when(failedOpenURLTrackerService.findAll(any(Context.class))).thenReturn(trackers); doNothing().when(openUrlService).tryReprocessFailed(any(Context.class), any(OpenURLTracker.class)); openUrlService.reprocessFailedQueue(context); verify(openUrlService, times(3)).tryReprocessFailed(any(Context.class), any(OpenURLTracker.class)); }
public void reprocessFailedQueue(Context context) throws SQLException { if (failedOpenUrlTrackerService == null) { log.error("Error retrieving the \"failedOpenUrlTrackerService\" instance, aborting the processing"); return; } List<OpenURLTracker> openURLTrackers = failedOpenUrlTrackerService.findAll(context); for (OpenURLTracker openURLTracker : openURLTrackers) { tryReprocessFailed(context, openURLTracker); } }
OpenUrlServiceImpl implements OpenUrlService { public void reprocessFailedQueue(Context context) throws SQLException { if (failedOpenUrlTrackerService == null) { log.error("Error retrieving the \"failedOpenUrlTrackerService\" instance, aborting the processing"); return; } List<OpenURLTracker> openURLTrackers = failedOpenUrlTrackerService.findAll(context); for (OpenURLTracker openURLTracker : openURLTrackers) { tryReprocessFailed(context, openURLTracker); } } }
OpenUrlServiceImpl implements OpenUrlService { public void reprocessFailedQueue(Context context) throws SQLException { if (failedOpenUrlTrackerService == null) { log.error("Error retrieving the \"failedOpenUrlTrackerService\" instance, aborting the processing"); return; } List<OpenURLTracker> openURLTrackers = failedOpenUrlTrackerService.findAll(context); for (OpenURLTracker openURLTracker : openURLTrackers) { tryReprocessFailed(context, openURLTracker); } }  }
OpenUrlServiceImpl implements OpenUrlService { public void reprocessFailedQueue(Context context) throws SQLException { if (failedOpenUrlTrackerService == null) { log.error("Error retrieving the \"failedOpenUrlTrackerService\" instance, aborting the processing"); return; } List<OpenURLTracker> openURLTrackers = failedOpenUrlTrackerService.findAll(context); for (OpenURLTracker openURLTracker : openURLTrackers) { tryReprocessFailed(context, openURLTracker); } }  void processUrl(Context c, String urlStr); void reprocessFailedQueue(Context context); void logfailed(Context context, String url); }
OpenUrlServiceImpl implements OpenUrlService { public void reprocessFailedQueue(Context context) throws SQLException { if (failedOpenUrlTrackerService == null) { log.error("Error retrieving the \"failedOpenUrlTrackerService\" instance, aborting the processing"); return; } List<OpenURLTracker> openURLTrackers = failedOpenUrlTrackerService.findAll(context); for (OpenURLTracker openURLTracker : openURLTrackers) { tryReprocessFailed(context, openURLTracker); } }  void processUrl(Context c, String urlStr); void reprocessFailedQueue(Context context); void logfailed(Context context, String url);  }