DMNFeelExpressionEvaluator extends AbstractExpressionEvaluator { protected FEEL newFeelEvaluator(AtomicReference<FEELEvent> errorHolder) { errorHolder.set(null); FEEL feel = FEEL.newInstance(singletonList(new ExtendedDMNProfile())); feel.addListener(event -> { FEELEvent feelEvent = errorHolder.get(); if (!(feelEvent instanceof SyntaxErrorEvent) && ERROR.equals(event.getSeverity())) { errorHolder.set(event); } }); return feel; } DMNFeelExpressionEvaluator(ClassLoader classLoader); @Override String fromObjectToExpression(Object value);  }
@Test public void listenerTest() { FEELEvent syntaxErrorEvent = new SyntaxErrorEvent(Severity.ERROR, "test", null, 0, 0, null); FEELEvent genericError = new FEELEventBase(Severity.ERROR, "error", null); FEELEvent notError = new FEELEventBase(Severity.INFO, "info", null); AtomicReference<FEELEvent> error = new AtomicReference<>(); FEEL feel = expressionEvaluator.newFeelEvaluator(error); applyEvents(Collections.singletonList(syntaxErrorEvent), feel); assertEquals(syntaxErrorEvent, error.get()); error.set(null); applyEvents(Arrays.asList(genericError, syntaxErrorEvent), feel); assertEquals(syntaxErrorEvent, error.get()); error.set(null); applyEvents(Arrays.asList(syntaxErrorEvent, genericError), feel); assertEquals(syntaxErrorEvent, error.get()); error.set(null); applyEvents(Collections.singletonList(notError), feel); assertNull(error.get()); }