File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
src/test/java/dev/openfeature/sdk/testutils/jackson Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -36,12 +36,17 @@ public CelContextEvaluator(String expression) {
36
36
@ Override
37
37
@ SuppressWarnings ("unchecked" )
38
38
public T evaluate (Flag flag , EvaluationContext evaluationContext ) {
39
- try {
40
- Map <String , Object > objectMap = new HashMap <>(Map .of ("email" , "" ));
39
+ Map <String , Object > objectMap = new HashMap <>();
40
+ // Provide defaults for all declared variables to prevent runtime errors.
41
+ objectMap .put ("email" , "" );
42
+ objectMap .put ("customer" , "" );
43
+ objectMap .put ("dummy" , "" );
44
+
41
45
if (evaluationContext != null ) {
42
- // Evaluate with context
46
+ // Evaluate with context, overriding defaults.
43
47
objectMap .putAll (evaluationContext .asObjectMap ());
44
48
}
49
+ }
45
50
46
51
Object result = program .eval (objectMap );
47
52
You can’t perform that action at this time.
0 commit comments