HttpRepository implements Repository { private boolean equalsIgnoreVersion(String path1, String path2, Pattern versionPattern) { if (versionPattern == null) { return false; } String path1NoVersion; Matcher matcher1 = versionPattern.matcher(path1); if (!matcher1.find()) { return false; } path1NoVersion = matcher1.replaceAll(""); String path2NoVersion; Matcher matcher2 = versionPattern.matcher(path2); if (!matcher2.find()) { return false; } path2NoVersion = matcher2.replaceAll(""); return path1NoVersion.equals(path2NoVersion); } @Inject  HttpRepository(CoordinatorConfig config);  HttpRepository(Iterable<URI> baseUris, String configShortNamePattern, String configVersionPattern, String binaryVersionPattern); @Override String configShortName(String config); @Override String configRelativize(String config); @Override String configResolve(String config); @Override String configUpgrade(String config, String version); @Override boolean configEqualsIgnoreVersion(String config1, String config2); @Override URI configToHttpUri(String config); @Override String binaryRelativize(String binary); @Override String binaryResolve(String binary); @Override String binaryUpgrade(String binary, String version); @Override boolean binaryEqualsIgnoreVersion(String binary1, String binary2); @Override URI binaryToHttpUri(String binary); static String upgradePath(String spec, String version, Pattern versionPattern); @Override String toString();  }
@Test public void equalsIgnoreVersion() throws Exception { Assert.assertTrue(repo.configEqualsIgnoreVersion("@apple-1.0.tar.gz", "@apple-2.0.tar.gz")); Assert.assertTrue(repo.binaryEqualsIgnoreVersion("apple-1.0.tar.gz", "apple-2.0.tar.gz")); Assert.assertFalse(repo.configEqualsIgnoreVersion("@apple-1.0.tar.gz", "@banana-1.0.tar.gz")); Assert.assertFalse(repo.binaryEqualsIgnoreVersion("apple-1.0.tar.gz", "banana-1.0.tar.gz")); }