use of org.mule.runtime.core.internal.exception.MessagingException in project mule by mulesoft.
the class MessagingExceptionResolverTestCase method resolveWithMultipleErrors.
@Test
public void resolveWithMultipleErrors() {
Optional<Error> surfaceError = mockError(TRANSFORMER, TRANSFORMER_EXCEPTION);
when(event.getError()).thenReturn(surfaceError);
Exception cause = new Exception(new ConnectionException(FATAL_EXCEPTION));
MessagingException me = newMessagingException(cause, event, processor);
MessagingException resolved = resolver.resolve(me, context);
assertExceptionErrorType(resolved, FATAL);
assertExceptionMessage(resolved.getMessage(), FATAL_EXCEPTION.getMessage());
}
use of org.mule.runtime.core.internal.exception.MessagingException in project mule by mulesoft.
the class MessagingExceptionResolverTestCase method resolveMultipleCriticalErrors.
@Test
public void resolveMultipleCriticalErrors() {
Throwable t = new LinkageError("this one is NOT expected", new java.lang.Error(new java.lang.Error("expected")));
MessagingException me = newMessagingException(t, event, processor);
MessagingException resolved = resolver.resolve(me, context);
assertExceptionErrorType(resolved, CRITICAL);
assertExceptionMessage(resolved.getMessage(), "expected");
}
use of org.mule.runtime.core.internal.exception.MessagingException in project mule by mulesoft.
the class AbstractSplitterTestCase method allFilteredSplitter.
@Test
public void allFilteredSplitter() throws Exception {
TestSplitter splitter = new TestSplitter(true);
splitter.setListener(event -> {
throw new MessagingException(createStaticMessage("Expected"), event, splitter);
});
splitter.setMuleContext(muleContext);
Apple apple = new Apple();
Banana banana = new Banana();
Orange orange = new Orange();
FruitBowl fruitBowl = new FruitBowl();
fruitBowl.addFruit(apple);
fruitBowl.addFruit(banana);
fruitBowl.addFruit(orange);
final CoreEvent inEvent = eventBuilder(muleContext).message(of(fruitBowl)).build();
CoreEvent resultEvent = splitter.process(inEvent);
assertThat(resultEvent.getMessage().getPayload().getValue(), nullValue());
}
use of org.mule.runtime.core.internal.exception.MessagingException in project mule by mulesoft.
the class AbstractSplitterTestCase method failingNotFilteredSplitter.
@Test
public void failingNotFilteredSplitter() throws Exception {
TestSplitter splitter = new TestSplitter(false);
splitter.setListener(event -> {
throw new MessagingException(createStaticMessage("Expected"), event, splitter);
});
splitter.setMuleContext(muleContext);
Apple apple = new Apple();
Banana banana = new Banana();
Orange orange = new Orange();
FruitBowl fruitBowl = new FruitBowl();
fruitBowl.addFruit(apple);
fruitBowl.addFruit(banana);
fruitBowl.addFruit(orange);
final CoreEvent inEvent = eventBuilder(muleContext).message(of(fruitBowl)).build();
expected.expect(MessagingException.class);
expected.expectMessage("Expected");
splitter.process(inEvent);
}
Aggregations