Skip to content

Commit

Permalink
fix failed test
Browse files Browse the repository at this point in the history
Signed-off-by: aserkes <[email protected]>
  • Loading branch information
aserkes committed Mar 1, 2023
1 parent eb88933 commit f1e4c6c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Oracle and/or its affiliates.
* Copyright (c) 2022, 2023 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -171,7 +171,7 @@ public VisitResult visitCondition(Condition condition, Context ctx) {
default:
throw new IllegalStateException("Bad input type");
}
});
}).asBoolean();
} catch (Expression.UnresolvedVariableException ex) {
errors.add(String.format("%s %s: '%s'",
condition.location(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public void testTernaryExpression() {
Expression exp;
Map<String, Value> variables;

exp = Expression.parse("'circle'");
assertThat(exp.eval().asText(), is("circle"));

exp = Expression.parse("${shape} == 'circle' ? 'red' : 'blue'");
variables = Map.of("shape", Value.create("circle"));
assertThat(exp.eval(variables::get).asText(), is("red"));
Expand Down

0 comments on commit f1e4c6c

Please sign in to comment.