From b69065393985018d014baacca009c0df581960b4 Mon Sep 17 00:00:00 2001 From: Kyle Robbins <83452106+KyRobbins@users.noreply.github.com> Date: Wed, 27 Dec 2023 21:03:32 -0500 Subject: [PATCH] Add test case to expose bug with placeholder in default value for known value --- .../org/codehaus/mojo/properties/PropertyResolverTest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test/java/org/codehaus/mojo/properties/PropertyResolverTest.java b/src/test/java/org/codehaus/mojo/properties/PropertyResolverTest.java index f2b75af..b31b466 100644 --- a/src/test/java/org/codehaus/mojo/properties/PropertyResolverTest.java +++ b/src/test/java/org/codehaus/mojo/properties/PropertyResolverTest.java @@ -238,9 +238,11 @@ public void testDefaultValueForUnresolvedPropertyWithEnabledFlag() { properties.setProperty("p11", "${malformed:with extra :"); properties.setProperty("p12", "${unknown::}"); properties.setProperty("p13", "${unknown: }"); + properties.setProperty("p14", "${knownValue:${fallback}}"); properties.setProperty("host", "example.com"); properties.setProperty("port", "9090"); + properties.setProperty("knownValue", "known value"); properties.setProperty("fallback", "fallback value"); String value1 = resolver.getPropertyValue("p1", properties, new Properties(), true); @@ -256,6 +258,7 @@ public void testDefaultValueForUnresolvedPropertyWithEnabledFlag() { String value11 = resolver.getPropertyValue("p11", properties, new Properties(), true); String value12 = resolver.getPropertyValue("p12", properties, new Properties(), true); String value13 = resolver.getPropertyValue("p13", properties, new Properties(), true); + String value14 = resolver.getPropertyValue("p14", properties, new Properties(), true); assertEquals("${unknown}", value1); assertEquals("defaultValue", value2); @@ -270,6 +273,7 @@ public void testDefaultValueForUnresolvedPropertyWithEnabledFlag() { assertEquals("${malformed:with extra :", value11); assertEquals(":", value12); assertEquals(" ", value13); + assertEquals("known value", value14); } /**