IvySourceControl extends FakeUserSourceControl { @SuppressWarnings ("unchecked") Collection<Artifact> artifacts() throws IOException, ParseException { final Ivy ivy = Ivy.newInstance(); ivy.configure(ivySettings.toURI().toURL()); return ivy.resolve(ivyXml.toURI().toURL()).getArtifacts(); }  @Override List<Modification> getModifications(final Date lastBuild, final Date now); @Override void validate(); String getIvyXml(); void setIvyXml(final String ivyXml); void setIvySettings(final String ivySettings); String getIvySettings();  }
@Test public void shouldReportNoDependenciesWhenAllOlder() { List<Modification> modifications = getMods(artifacts(new MockArtifact("foo.jar", EVEN_LONGER_AGO), new MockArtifact("bar.jar", EVEN_LONGER_AGO))); assertEquals(0, modifications.size()); }
@Test public void shouldSetRevisionDateToPublicationDate() { Date publicationDate = new Date(); List<Modification> mods = getMods(artifacts(new MockArtifact("foo.jar", publicationDate))); assertEquals(publicationDate, mods.get(0).getModifiedTime()); }
@Test public void shouldSetRevisionToArtifactRevision() { MockArtifact mockArtifact = new MockArtifact("foo.jar"); ModuleId id = new ModuleId("organization", "name"); ArtifactRevisionId artifactId = new ArtifactRevisionId( new ArtifactId(id, "name", "type", "ext" + System.currentTimeMillis()), new ModuleRevisionId(id, "revision") ); mockArtifact.setArtifactRevisionId(artifactId); List<Modification> mods = getMods(artifacts(mockArtifact)); assertEquals(artifactId.toString(), mods.get(0).getRevision()); }
@Test public void shouldSetFolderToUrlMinusFilename() { MockArtifact mockArtifact = new MockArtifact("foo.jar"); mockArtifact.setUrl("file: List<Modification> mods = getMods(artifacts(mockArtifact)); assertEquals("file: }
@Test public void shouldReportNotModifiedWhenArtifactPublicationBeforeLastBuildOnSecondRun() { Collection<Artifact> artifacts = artifacts(new MockArtifact("foo.jar", EVEN_LONGER_AGO)); getMods(artifacts); List<Modification> secondRun = getMods(artifacts); assertEquals(0, secondRun.size()); }