From 5ae4e0fc16b7c40a5594f5ddd3ba43d4e425558c Mon Sep 17 00:00:00 2001 From: Falko Modler Date: Tue, 14 Dec 2021 01:09:50 +0100 Subject: [PATCH] Extend ModelUtilsTest with Maven CI friendly version case from #22171 --- .../maven/workspace/ModelUtilsTest.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/workspace/ModelUtilsTest.java b/independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/workspace/ModelUtilsTest.java index 9af5d22a23a96..6acd892f11f00 100644 --- a/independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/workspace/ModelUtilsTest.java +++ b/independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/workspace/ModelUtilsTest.java @@ -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}"); } }