use of org.mule.runtime.api.connection.ConnectionException in project mule by mulesoft.
the class ExceptionHandlerManagerTestCase method processAndEnrich.
@Test
public void processAndEnrich() {
ConnectionException connectionException = new ConnectionException("Connection Error");
Throwable throwable = manager.process(connectionException);
assertThat(throwable, is(not(sameInstance(connectionException))));
assertThat(throwable, is(instanceOf(HeisenbergException.class)));
assertThat(throwable.getMessage(), is(ERROR_MESSAGE));
}
use of org.mule.runtime.api.connection.ConnectionException in project mule by mulesoft.
the class ExceptionUtilsTestCase method extractRootConnectionException.
@Test
public void extractRootConnectionException() {
Exception withConnectionExceptionCause = new Exception(new ConnectionException(ERROR_MESSAGE, new ConnectionException(new NullPointerException())));
Optional<ConnectionException> connectionException = extractConnectionException(withConnectionExceptionCause);
assertThat(connectionException.isPresent(), is(true));
assertThat(connectionException.get().getMessage(), is(ERROR_MESSAGE));
}
use of org.mule.runtime.api.connection.ConnectionException in project mule by mulesoft.
the class ExceptionUtilsTestCase method extractMissingConnectionException.
@Test
public void extractMissingConnectionException() {
Exception withoutConnectionException = new Exception(new NullPointerException());
Optional<ConnectionException> exception = extractConnectionException(withoutConnectionException);
assertThat(exception.isPresent(), is(false));
}
use of org.mule.runtime.api.connection.ConnectionException 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());
}
Aggregations