@Test(dataProvider = "extractPackageNameProvider") public void extractPackageNameTest(String line, String packageName, boolean isExpectingFilePath, String expectedPackageName, boolean expectedExpectingFilePath, Map<String, String> expectedDepMap) { Map<String, String> downloadedDependencies = new HashMap<>(); Matcher matcher = COLLECTING_PACKAGE_PATTERN.matcher(line); matcher.find(); MutableBoolean expectingFilePath = new MutableBoolean(isExpectingFilePath); String actualPackageName = PipLogParser.extractPackageName(downloadedDependencies, matcher, packageName, expectingFilePath, log); assertEquals(actualPackageName, expectedPackageName); assertEquals(expectingFilePath.booleanValue(), expectedExpectingFilePath); assertEquals(downloadedDependencies.keySet(), expectedDepMap.keySet()); assertEquals(downloadedDependencies.values(), expectedDepMap.values()); }
static String extractPackageName(Map<String, String> downloadedDependencies, Matcher matcher, String packageName, MutableBoolean expectingPackageFilePath, Log logger) { if (expectingPackageFilePath.isTrue()) { logger.debug(String.format("Could not resolve download path for package: %s, continuing...", packageName)); downloadedDependencies.put(StringUtils.lowerCase(packageName), ""); } expectingPackageFilePath.setTrue(); return matcher.group(1); }
PipLogParser { static String extractPackageName(Map<String, String> downloadedDependencies, Matcher matcher, String packageName, MutableBoolean expectingPackageFilePath, Log logger) { if (expectingPackageFilePath.isTrue()) { logger.debug(String.format("Could not resolve download path for package: %s, continuing...", packageName)); downloadedDependencies.put(StringUtils.lowerCase(packageName), ""); } expectingPackageFilePath.setTrue(); return matcher.group(1); } }
PipLogParser { static String extractPackageName(Map<String, String> downloadedDependencies, Matcher matcher, String packageName, MutableBoolean expectingPackageFilePath, Log logger) { if (expectingPackageFilePath.isTrue()) { logger.debug(String.format("Could not resolve download path for package: %s, continuing...", packageName)); downloadedDependencies.put(StringUtils.lowerCase(packageName), ""); } expectingPackageFilePath.setTrue(); return matcher.group(1); }  }
PipLogParser { static String extractPackageName(Map<String, String> downloadedDependencies, Matcher matcher, String packageName, MutableBoolean expectingPackageFilePath, Log logger) { if (expectingPackageFilePath.isTrue()) { logger.debug(String.format("Could not resolve download path for package: %s, continuing...", packageName)); downloadedDependencies.put(StringUtils.lowerCase(packageName), ""); } expectingPackageFilePath.setTrue(); return matcher.group(1); }   }
PipLogParser { static String extractPackageName(Map<String, String> downloadedDependencies, Matcher matcher, String packageName, MutableBoolean expectingPackageFilePath, Log logger) { if (expectingPackageFilePath.isTrue()) { logger.debug(String.format("Could not resolve download path for package: %s, continuing...", packageName)); downloadedDependencies.put(StringUtils.lowerCase(packageName), ""); } expectingPackageFilePath.setTrue(); return matcher.group(1); }    }