@Test(dataProvider = "extractDownloadedFileNameProvider") public void extractDownloadedFileNameTest(String line, String packageName, boolean isExpectingFilePath, boolean expectedExpectingFilePath, Map<String, String> expectedDepMap) { Map<String, String> downloadedDependencies = new HashMap<>(); Matcher matcher = DOWNLOADED_FILE_PATTERN.matcher(line); matcher.find(); MutableBoolean expectingFilePath = new MutableBoolean(isExpectingFilePath); PipLogParser.extractDownloadedFileName(downloadedDependencies, matcher, packageName, expectingFilePath, log); assertEquals(expectingFilePath.booleanValue(), expectedExpectingFilePath); assertEquals(downloadedDependencies.keySet(), expectedDepMap.keySet()); assertEquals(downloadedDependencies.values(), expectedDepMap.values()); }
static void extractDownloadedFileName(Map<String, String> downloadedDependencies, Matcher matcher, String packageName, MutableBoolean expectingPackageFilePath, Log logger) { if (expectingPackageFilePath.isFalse()) { logger.debug(String.format("Could not determine package-name for path: %s, continuing...", matcher.group(1))); return; } String filePath = matcher.group(1); downloadedDependencies.put(StringUtils.lowerCase(packageName), filePath); expectingPackageFilePath.setFalse(); logger.debug(String.format("Found package: %s installed with: %s", packageName, filePath)); }
PipLogParser { static void extractDownloadedFileName(Map<String, String> downloadedDependencies, Matcher matcher, String packageName, MutableBoolean expectingPackageFilePath, Log logger) { if (expectingPackageFilePath.isFalse()) { logger.debug(String.format("Could not determine package-name for path: %s, continuing...", matcher.group(1))); return; } String filePath = matcher.group(1); downloadedDependencies.put(StringUtils.lowerCase(packageName), filePath); expectingPackageFilePath.setFalse(); logger.debug(String.format("Found package: %s installed with: %s", packageName, filePath)); } }
PipLogParser { static void extractDownloadedFileName(Map<String, String> downloadedDependencies, Matcher matcher, String packageName, MutableBoolean expectingPackageFilePath, Log logger) { if (expectingPackageFilePath.isFalse()) { logger.debug(String.format("Could not determine package-name for path: %s, continuing...", matcher.group(1))); return; } String filePath = matcher.group(1); downloadedDependencies.put(StringUtils.lowerCase(packageName), filePath); expectingPackageFilePath.setFalse(); logger.debug(String.format("Found package: %s installed with: %s", packageName, filePath)); }  }
PipLogParser { static void extractDownloadedFileName(Map<String, String> downloadedDependencies, Matcher matcher, String packageName, MutableBoolean expectingPackageFilePath, Log logger) { if (expectingPackageFilePath.isFalse()) { logger.debug(String.format("Could not determine package-name for path: %s, continuing...", matcher.group(1))); return; } String filePath = matcher.group(1); downloadedDependencies.put(StringUtils.lowerCase(packageName), filePath); expectingPackageFilePath.setFalse(); logger.debug(String.format("Found package: %s installed with: %s", packageName, filePath)); }   }
PipLogParser { static void extractDownloadedFileName(Map<String, String> downloadedDependencies, Matcher matcher, String packageName, MutableBoolean expectingPackageFilePath, Log logger) { if (expectingPackageFilePath.isFalse()) { logger.debug(String.format("Could not determine package-name for path: %s, continuing...", matcher.group(1))); return; } String filePath = matcher.group(1); downloadedDependencies.put(StringUtils.lowerCase(packageName), filePath); expectingPackageFilePath.setFalse(); logger.debug(String.format("Found package: %s installed with: %s", packageName, filePath)); }    }