ArtifactImpl extends BlueArtifact { @Override public String getUrl() { return String.format("/%sartifact/%s", run.getUrl(), artifact.getHref()); } ArtifactImpl(Run run, Run.Artifact artifact, Link parent); @Override String getName(); @Override String getPath(); @Override String getUrl(); @Override long getSize(); @Override boolean isDownloadable();  }
@Test public void findUniqueArtifactsWithSameName() throws IllegalAccessException { Run.Artifact artifact1 = mock(Run.Artifact.class); Run.Artifact artifact2 = mock(Run.Artifact.class); when(artifact1.getFileName()).thenReturn("test-suite.log"); MemberModifier.field(Run.Artifact.class, "relativePath").set(artifact1, "path1/test-suite.log"); when(artifact1.getHref()).thenReturn("path1/test-suite.log"); when(artifact2.getFileName()).thenReturn("test-suite.log"); MemberModifier.field(Run.Artifact.class, "relativePath").set(artifact2, "path2/test-suite.log"); when(artifact2.getHref()).thenReturn("path2/test-suite.log"); ArrayList artifactList = new ArrayList(); artifactList.add(artifact1); artifactList.add(artifact2); Run run = mock(Run.class); when(run.getUrl()).thenReturn("job/myfolder/job/myjob/1/"); when(run.getArtifacts()).thenReturn(artifactList); Link parentLink = mock(Link.class); ArtifactImpl a1 = new ArtifactImpl(run, artifact1, parentLink); ArtifactImpl a2 = new ArtifactImpl(run, artifact2, parentLink); assertThat(a1.getId(), is(not(a2.getId()))); }