Skip to content

Commit

Permalink
Add multiple fallback macro test
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienlauer committed Dec 18, 2018
1 parent 22950f6 commit 75f259b
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ public void setUp() throws Exception {
),
new MapNode(
new NamedNode("message", "${'1:2:3'}")
),
new MapNode(
new NamedNode("message", "${unknown:other:'fallback'}")
)
))
);
Expand Down Expand Up @@ -144,6 +147,11 @@ public void testNestedRef() throws Exception {
assertThat(evaluate("refOfRef")).isEqualTo("null");
}

@Test
public void testMultipleDefaults() throws Exception {
assertThat(evaluate("test[14].message")).isEqualTo("fallback");
}

private String evaluate(String path) {
return macroEvaluator.evaluate(config, config.get(path).get()).value();
}
Expand Down

0 comments on commit 75f259b

Please sign in to comment.