|
@@ -22,6 +22,11 @@ public class PlaceholderHelperTest {
|
|
|
check("${some.key:100}", "some.key");
|
|
|
check("${some.key:${some.other.key}}", "some.key", "some.other.key");
|
|
|
check("${some.key:${some.other.key:100}}", "some.key", "some.other.key");
|
|
|
+
|
|
|
+ check("${some.key}/xx", "some.key");
|
|
|
+ check("${some.key:100}/xx", "some.key");
|
|
|
+ check("${some.key:${some.other.key}/xx}/yy", "some.key", "some.other.key");
|
|
|
+ check("${some.key:${some.other.key:100}/xx}/yy", "some.key", "some.other.key");
|
|
|
}
|
|
|
|
|
|
@Test
|
|
@@ -30,12 +35,21 @@ public class PlaceholderHelperTest {
|
|
|
check("${${some.key:other.key}}", "some.key");
|
|
|
check("${${some.key}:100}", "some.key");
|
|
|
check("${${some.key}:${another.key}}", "some.key", "another.key");
|
|
|
+
|
|
|
+ check("${${some.key}/xx}/xx", "some.key");
|
|
|
+ check("${${some.key:other.key/xx}/xx}/xx", "some.key");
|
|
|
+ check("${${some.key}/xx:100}/xx", "some.key");
|
|
|
+ check("${${some.key}/xx:${another.key}/xx}xx", "some.key", "another.key");
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
public void testExtractComplexNestedPlaceholderKeys() throws Exception {
|
|
|
check("${${a}1${b}:3.${c:${d:100}}}", "a", "b", "c", "d");
|
|
|
check("${1${a}2${b}3:4.${c:5${d:100}6}7}", "a", "b", "c", "d");
|
|
|
+
|
|
|
+ check("${${a}1${b}:3.${c:${d:100}}}/xx", "a", "b", "c", "d");
|
|
|
+ check("${1${a}2${b}3:4.${c:5${d:100}6}7}/xx", "a", "b", "c", "d");
|
|
|
}
|
|
|
|
|
|
@Test
|
|
@@ -46,6 +60,13 @@ public class PlaceholderHelperTest {
|
|
|
check("#{new java.text.SimpleDateFormat('${some.key:${some.other.key:abc}}').parse('${another.key}')}", "some.key", "another.key", "some.other.key");
|
|
|
check("#{new java.text.SimpleDateFormat('${${some.key}}').parse('${${another.key:other.key}}')}", "some.key", "another.key");
|
|
|
|
|
|
+ check("#{new java.text.SimpleDateFormat('${some.key}/xx').parse('${another.key}/xx')}", "some.key", "another.key");
|
|
|
+ check("#{new java.text.SimpleDateFormat('${some.key:abc}/xx').parse('${another.key:100}/xx')}", "some.key", "another.key");
|
|
|
+ check("#{new java.text.SimpleDateFormat('${some.key:${some.other.key}/xx}/xx').parse('${another.key}/xx')}", "some.key", "another.key", "some.other.key");
|
|
|
+ check("#{new java.text.SimpleDateFormat('${some.key:${some.other.key:abc}/xx}/xx').parse('${another.key}/xx')}", "some.key", "another.key", "some.other.key");
|
|
|
+ check("#{new java.text.SimpleDateFormat('${${some.key}/xx}').parse('${${another.key:other.key}/xx}/xx')}", "some.key", "another.key");
|
|
|
+
|
|
|
+
|
|
|
assertTrue(placeholderHelper.extractPlaceholderKeys("#{systemProperties[some.key] ?: 123}").isEmpty());
|
|
|
assertTrue(placeholderHelper.extractPlaceholderKeys("#{ T(java.lang.Math).random() * 100.0 }").isEmpty());
|
|
|
}
|