### Question:
ArtifactResourceURLStreamHandler extends URLStreamHandler { public static URL newURL(IArtifactMetadata artifact, String relpath, URL resource) { try { StringBuilder host = new StringBuilder(); host.append(artifact.getGroupId()); host.append(':').append(artifact.getArtifactId()); host.append(':').append(artifact.getVersion()); if (artifact.getClassifier() != null && !artifact.getClassifier().isEmpty()) { host.append(':').append(artifact.getClassifier()); } return new URL(PROTOCOL, host.toString(), -1, relpath, new ArtifactResourceURLStreamHandler(resource)); } catch (MalformedURLException e) { throw new UncheckedIOException(e); } } ArtifactResourceURLStreamHandler(URL resource); static URL newURL(IArtifactMetadata artifact, String relpath, URL resource); static final String PROTOCOL; }### Answer:
@Test public void testEquals() throws Exception { String relpath = "file.txt"; IArtifactMetadata artifactA = new TestArtifactMetadata("g:a:1"); File dirA = newDirArtifact(relpath); URL resourceA = new File(dirA, relpath).toURI().toURL(); IArtifactMetadata artifactB = new TestArtifactMetadata("g:b:1"); File dirB = newDirArtifact(relpath); URL resourceB = new File(dirB, relpath).toURI().toURL(); assertThat(dirA).isNotEqualTo(dirB); URL urlA = ArtifactResourceURLStreamHandler.newURL(artifactA, relpath, resourceA); URL urlB = ArtifactResourceURLStreamHandler.newURL(artifactB, relpath, resourceB); assertThat(urlA.equals(urlB)).isFalse(); }