Skip to content

Commit 75f259b

Browse files
committed
Add multiple fallback macro test
1 parent 22950f6 commit 75f259b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/test/java/org/seedstack/coffig/evaluator/MacroEvaluatorTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ public void setUp() throws Exception {
9191
),
9292
new MapNode(
9393
new NamedNode("message", "${'1:2:3'}")
94+
),
95+
new MapNode(
96+
new NamedNode("message", "${unknown:other:'fallback'}")
9497
)
9598
))
9699
);
@@ -144,6 +147,11 @@ public void testNestedRef() throws Exception {
144147
assertThat(evaluate("refOfRef")).isEqualTo("null");
145148
}
146149

150+
@Test
151+
public void testMultipleDefaults() throws Exception {
152+
assertThat(evaluate("test[14].message")).isEqualTo("fallback");
153+
}
154+
147155
private String evaluate(String path) {
148156
return macroEvaluator.evaluate(config, config.get(path).get()).value();
149157
}

0 commit comments

Comments
 (0)