@Test public void testProcessResultsHasSkippedReposAndExceptions() { Logger mockLogger = mock(Logger.class); List<String> skippedRepos = Collections.singletonList("skipped"); try { ResultsProcessor.processResults(skippedRepos, Collections.singletonList(new IOException("test")), mockLogger); fail(); } catch (IOException exception) { verify(mockLogger, times(1)).info(REPOS_SKIPPED_MESSAGE, skippedRepos); } }
public static void processResults(List<String> skippedRepos, List<IOException> exceptions, Logger logger) throws IOException { if (!skippedRepos.isEmpty()) { logger.info(REPOS_SKIPPED_MESSAGE, skippedRepos); } if (!exceptions.isEmpty()) { throw new IOException(String.format("There were %s errors with changing Dockerfiles.", exceptions.size())); } }
ResultsProcessor { public static void processResults(List<String> skippedRepos, List<IOException> exceptions, Logger logger) throws IOException { if (!skippedRepos.isEmpty()) { logger.info(REPOS_SKIPPED_MESSAGE, skippedRepos); } if (!exceptions.isEmpty()) { throw new IOException(String.format("There were %s errors with changing Dockerfiles.", exceptions.size())); } } }
ResultsProcessor { public static void processResults(List<String> skippedRepos, List<IOException> exceptions, Logger logger) throws IOException { if (!skippedRepos.isEmpty()) { logger.info(REPOS_SKIPPED_MESSAGE, skippedRepos); } if (!exceptions.isEmpty()) { throw new IOException(String.format("There were %s errors with changing Dockerfiles.", exceptions.size())); } }  }
ResultsProcessor { public static void processResults(List<String> skippedRepos, List<IOException> exceptions, Logger logger) throws IOException { if (!skippedRepos.isEmpty()) { logger.info(REPOS_SKIPPED_MESSAGE, skippedRepos); } if (!exceptions.isEmpty()) { throw new IOException(String.format("There were %s errors with changing Dockerfiles.", exceptions.size())); } }  static void processResults(List<String> skippedRepos, List<IOException> exceptions, Logger logger); }
ResultsProcessor { public static void processResults(List<String> skippedRepos, List<IOException> exceptions, Logger logger) throws IOException { if (!skippedRepos.isEmpty()) { logger.info(REPOS_SKIPPED_MESSAGE, skippedRepos); } if (!exceptions.isEmpty()) { throw new IOException(String.format("There were %s errors with changing Dockerfiles.", exceptions.size())); } }  static void processResults(List<String> skippedRepos, List<IOException> exceptions, Logger logger); static final String REPOS_SKIPPED_MESSAGE; }