You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2019/08/05 15:26:31 UTC
[commons-configuration] 03/03: Tests an interpolation that consists
of a single undefined variable only with and without a default value.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-configuration.git
commit 9bab62a2e6a2bffe32d2d664267c46daf5f73b68
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Aug 5 11:26:23 2019 -0400
Tests an interpolation that consists of a single undefined variable only
with and without a default value.
---
.../interpol/TestConfigurationInterpolator.java | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/test/java/org/apache/commons/configuration2/interpol/TestConfigurationInterpolator.java b/src/test/java/org/apache/commons/configuration2/interpol/TestConfigurationInterpolator.java
index 937fde2..24fca68 100644
--- a/src/test/java/org/apache/commons/configuration2/interpol/TestConfigurationInterpolator.java
+++ b/src/test/java/org/apache/commons/configuration2/interpol/TestConfigurationInterpolator.java
@@ -353,6 +353,20 @@ public class TestConfigurationInterpolator
}
/**
+ * Tests an interpolation that consists of a single undefined variable only with and without a default value.
+ */
+ @Test
+ public void testInterpolationSingleVariableDefaultValue()
+ {
+ final Object value = 42;
+ interpolator.addDefaultLookup(setUpTestLookup(TEST_NAME, value));
+ assertEquals("Wrong result", "${I_am_not_defined}",
+ interpolator.interpolate("${I_am_not_defined}"));
+ assertEquals("Wrong result", "42",
+ interpolator.interpolate("${I_am_not_defined:-42}"));
+ }
+
+ /**
* Tests a variable declaration which lacks the trailing closing bracket.
*/
@Test