use of org.mule.runtime.core.internal.exception.MessagingException in project mule by mulesoft.
the class MessagingExceptionTestCase method nonSerializableMessagingException.
@Test
public void nonSerializableMessagingException() throws Exception {
TestNotSerializableMessageProcessor processor = new TestNotSerializableMessageProcessor();
MessagingException e = new MessagingException(createStaticMessage(message), testEvent, processor);
e = SerializationTestUtils.testException(e, muleContext);
assertThat(e.getMessage(), containsString(message));
assertThat(e.getFailingComponent(), is(nullValue()));
}
use of org.mule.runtime.core.internal.exception.MessagingException in project mule by mulesoft.
the class MessagingExceptionTestCase method causedExactlyByWithNullCause.
@Test
public void causedExactlyByWithNullCause() {
MessagingException exception = new MessagingException(createStaticMessage(""), testEvent);
assertThat(exception.causedExactlyBy(MessagingException.class), Is.is(true));
assertThat(exception.causedExactlyBy(Exception.class), Is.is(false));
assertThat(exception.causedExactlyBy(DefaultMuleException.class), Is.is(false));
assertThat(exception.causedExactlyBy(IOException.class), Is.is(false));
}
use of org.mule.runtime.core.internal.exception.MessagingException in project mule by mulesoft.
the class MessagingExceptionTestCase method withAnnotatedFailingProcessorNoPathResolver.
@Test
public void withAnnotatedFailingProcessorNoPathResolver() {
AnnotatedProcessor mockProcessor = mock(AnnotatedProcessor.class);
when(mockProcessor.getAnnotation(eq(docNameAttrName))).thenReturn("Mock Component");
configureProcessorLocation(mockProcessor);
MessagingException exception = new MessagingException(createStaticMessage(""), testEvent, mockProcessor);
exception.getInfo().putAll(locationProvider.getContextInfo(createInfo(testEvent, exception, mockProcessor), mockProcessor));
assertThat(exception.getInfo().get(INFO_LOCATION_KEY).toString(), is("Mock@1 @ MessagingExceptionTestCase:muleApp.xml:10 (Mock Component)"));
}
use of org.mule.runtime.core.internal.exception.MessagingException in project mule by mulesoft.
the class MessagingExceptionTestCase method causedByWithNonMuleCause.
@Test
public void causedByWithNonMuleCause() {
IOException causeException = new IOException("");
MessagingException exception = new MessagingException(createStaticMessage(""), testEvent, causeException);
assertThat(exception.causedBy(IOException.class), is(true));
assertThat(exception.causedBy(MessagingException.class), is(true));
assertThat(exception.causedBy(Exception.class), is(true));
assertThat(exception.causedBy(NullPointerException.class), is(false));
}
use of org.mule.runtime.core.internal.exception.MessagingException in project mule by mulesoft.
the class MessagingExceptionTestCase method withAnnotatedFailingProcessorNotPathResolver.
@Test
public void withAnnotatedFailingProcessorNotPathResolver() {
AnnotatedProcessor mockProcessor = mock(AnnotatedProcessor.class);
when(mockProcessor.getAnnotation(eq(docNameAttrName))).thenReturn("Mock Component");
configureProcessorLocation(mockProcessor);
MessagingException exception = new MessagingException(createStaticMessage(""), testEvent, mockProcessor);
exception.getInfo().putAll(locationProvider.getContextInfo(createInfo(testEvent, exception, mockProcessor), mockProcessor));
assertThat(exception.getInfo().get(INFO_LOCATION_KEY).toString(), is("Mock@1 @ MessagingExceptionTestCase:muleApp.xml:10 (Mock Component)"));
}
Aggregations