OpenUrlServiceImpl implements OpenUrlService { public void processUrl(Context c, String urlStr) throws SQLException { log.debug("Prepared to send url to tracker URL: " + urlStr); try { int responseCode = getResponseCodeFromUrl(urlStr); if (responseCode != HttpURLConnection.HTTP_OK) { logfailed(c, urlStr); } else if (log.isDebugEnabled()) { log.debug("Successfully posted " + urlStr + " on " + new Date()); } } catch (Exception e) { log.error("Failed to send url to tracker URL: " + urlStr); logfailed(c, urlStr); } }  void processUrl(Context c, String urlStr); void reprocessFailedQueue(Context context); void logfailed(Context context, String url);  }
@Test public void testProcessUrl() throws IOException, SQLException { Context context = mock(Context.class); doReturn(HttpURLConnection.HTTP_OK).when(openUrlService) .getResponseCodeFromUrl(anyString()); openUrlService.processUrl(context, "test-url"); verify(openUrlService, times(0)).logfailed(context, "test-url"); }