Fix assertions in Arguments

This commit is contained in:
Oleg Zhurakousky
2022-01-27 12:48:32 +01:00
parent 4a39306678
commit 42d8736d19

View File

@@ -32,7 +32,6 @@ import releaser.internal.project.ProjectVersion;
import releaser.internal.project.Projects;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
/**
* Arguments for a task.
@@ -83,11 +82,12 @@ public final class Arguments implements Serializable {
private Arguments(ProjectToRun thisProject, Projects projects,
ProjectVersion currentProjectFromBom) {
log.info("Creating Arguments for: " + thisProject.name() + "; Original version: " + thisProject.originalVersion);
log.info("Creating Arguments for: " + thisProject.name() + "; Original version: "
+ thisProject.originalVersion);
this.project = thisProject.thisProjectFolder;
this.projects = projects;
this.originalVersion = thisProject.originalVersion;
Assert.isTrue(!StringUtils.isEmpty(this.originalVersion),
Assert.isTrue(this.originalVersion != null,
"Original Version must not be empty for project: " + thisProject.name());
this.versionFromBom = currentProjectFromBom;
this.properties = thisProject.thisProjectReleaserProperties;
@@ -101,12 +101,13 @@ public final class Arguments implements Serializable {
// in this case the project will be the BOM
private Arguments(ProjectToRun thisProject,
List<ProcessedProject> processedProjects) {
log.info("Creating Arguments for: " + thisProject.name() + "; Original version: " + thisProject.originalVersion);
log.info("Creating Arguments for: " + thisProject.name() + "; Original version: "
+ thisProject.originalVersion);
this.project = thisProject.thisProjectFolder;
this.projects = new Projects(processedProjects.stream()
.map(p -> p.newProjectVersion).collect(Collectors.toSet()));
this.originalVersion = thisProject.originalVersion;
Assert.isTrue(!StringUtils.isEmpty(this.originalVersion),
Assert.isTrue(this.originalVersion != null,
"Original Version must not be empty for project: " + thisProject.name());
this.versionFromBom = thisProject.thisProjectVersionFromBom;
this.properties = thisProject.thisProjectReleaserProperties;