Search in sources :

Example 6 with FEELEventListener

use of org.kie.dmn.api.feel.runtime.events.FEELEventListener in project drools by kiegroup.

the class ExtendedFunctionsBaseFEELTest method testExpression.

@Test
public void testExpression() {
    FEELEventListener listener = mock(FEELEventListener.class);
    feel.addListener(listener);
    feel.addListener(evt -> {
        System.out.println(evt);
    });
    assertResult(expression, result);
    if (severity != null) {
        ArgumentCaptor<FEELEvent> captor = ArgumentCaptor.forClass(FEELEvent.class);
        verify(listener, atLeastOnce()).onEvent(captor.capture());
        assertThat(captor.getValue().getSeverity(), is(severity));
    } else {
        verify(listener, never()).onEvent(any(FEELEvent.class));
    }
}
Also used : FEELEventListener(org.kie.dmn.api.feel.runtime.events.FEELEventListener) FEELEvent(org.kie.dmn.api.feel.runtime.events.FEELEvent) Test(org.junit.Test)

Aggregations

FEELEvent (org.kie.dmn.api.feel.runtime.events.FEELEvent)6 FEELEventListener (org.kie.dmn.api.feel.runtime.events.FEELEventListener)6 Test (org.junit.Test)5 FEEL (org.kie.dmn.feel.FEEL)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Logger (org.slf4j.Logger)2 LoggerFactory (org.slf4j.LoggerFactory)2 BigDecimal (java.math.BigDecimal)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 Map (java.util.Map)1 UUID (java.util.UUID)1 Collectors (java.util.stream.Collectors)1 IntStream (java.util.stream.IntStream)1 CoreMatchers (org.hamcrest.CoreMatchers)1 Description (org.hamcrest.Description)1 Matcher (org.hamcrest.Matcher)1 Matchers (org.hamcrest.Matchers)1