Fail fast on snapshot / release version mismatch upon cloning
without this change we will know that Spring Cloud Release has wrong setup only when we do POM updates with this change, upon cloning the Spring Cloud Release project we will immediately check that there are snapshot versions for a release of a non-snapshot version of a project. If that's the case then we throw an exception. fixes #42
This commit is contained in:
@@ -34,4 +34,8 @@ public class Projects extends HashSet<ProjectVersion> {
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new IllegalStateException("Project with name [" + projectName + "] is not present"));
|
||||
}
|
||||
|
||||
public boolean containsSnapshots() {
|
||||
return this.stream().anyMatch(ProjectVersion::isSnapshot);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,26 @@ public class ProjectsTests {
|
||||
then(projects.forName("spring-cloud-starter-build").version).isEqualTo("1.0.0");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_return_true_when_there_is_at_least_one_snapshot_project() {
|
||||
Set<ProjectVersion> projectVersions = new HashSet<>();
|
||||
projectVersions.add(new ProjectVersion("foo", "1.0.0.BUILD-SNAPSHOT"));
|
||||
projectVersions.add(new ProjectVersion("bar", "1.0.0"));
|
||||
Projects projects = new Projects(projectVersions);
|
||||
|
||||
then(projects.containsSnapshots()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_return_false_when_there_are_no_snapshot_versions() {
|
||||
Set<ProjectVersion> projectVersions = new HashSet<>();
|
||||
projectVersions.add(new ProjectVersion("foo", "1.0.0"));
|
||||
projectVersions.add(new ProjectVersion("bar", "1.0.0"));
|
||||
Projects projects = new Projects(projectVersions);
|
||||
|
||||
then(projects.containsSnapshots()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_throw_exception_when_project_is_not_present_when_searching_by_file() {
|
||||
Set<ProjectVersion> projectVersions = new HashSet<>();
|
||||
|
||||
Reference in New Issue
Block a user