Skip to content

Commit

Permalink
Extend ModelUtilsTest with Maven CI friendly version case from #22171
Browse files Browse the repository at this point in the history
  • Loading branch information
famod committed Dec 14, 2021
1 parent dc93d7b commit 5ae4e0f
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,28 @@ void resolveVersion_allCiFriendlyPropertyNames() {
}

@Test
void resolveVersion_illegalPlaceholder() {
// better error message than "named capturing group is missing trailing '}'"
void resolveVersion_illegalPlaceholder_missingTrailing() {
var model = new Model();
model.getProperties().put("revision", "${main.project.version}");
model.getProperties().put("main.project.version", "1.6.0-SNAPSHOT");

assertThatThrownBy(() -> ModelUtils.resolveVersion("${revision}", model))
.isExactlyInstanceOf(IllegalArgumentException.class)
.hasMessageContainingAll("revision", "main.project.version");
.hasMessageContainingAll("revision", "${main.project.version}");
}

@Test
// better error message than "No group with name {version}"
// see also https://github.com/quarkusio/quarkus/issues/22171
void resolveVersion_illegalPlaceholder_noGroup() {
var model = new Model();
model.getProperties().put("revision", "${version}.${build}");
model.getProperties().put("version", "1.0.0");
model.getProperties().put("build", "0-SNAPSHOT");

assertThatThrownBy(() -> ModelUtils.resolveVersion("${revision}", model))
.isExactlyInstanceOf(IllegalArgumentException.class)
.hasMessageContainingAll("revision", "${version}");
}
}

0 comments on commit 5ae4e0f

Please sign in to comment.