use of org.kie.dmn.feel.lang.CompilerContext in project drools by kiegroup.
the class FEELErrorMessagesTest method ifWithoutElse2.
@Test
public void ifWithoutElse2() {
final FEEL feel = FEEL.newInstance();
final FEELEventListener fel = Mockito.mock(FEELEventListener.class);
feel.addListener(fel);
final CompilerContext ctx = feel.newCompilerContext();
feel.compile("if true then 123 456", ctx);
final ArgumentCaptor<FEELEvent> captor = ArgumentCaptor.forClass(FEELEvent.class);
verify(fel, times(1)).onEvent(captor.capture());
Assert.assertThat(captor.getAllValues().size(), is(1));
Assert.assertThat(captor.getAllValues().get(0), is(instanceOf(SyntaxErrorEvent.class)));
Assert.assertThat(((SyntaxErrorEvent) captor.getAllValues().get(0)).getMessage(), is("missing 'else' at '456'"));
}
Aggregations