@Test public void nestedExceptionRetrieval() throws Exception { Exception testException = getException(); Throwable t = getRootException(testException); assertNotNull(t); assertThat(t.getMessage(), is("blah")); assertThat(t.getCause(), nullValue()); t = getRootMuleException(testException); assertThat(t.getMessage(), is("bar")); assertThat(t.getCause(), not(nullValue())); List<Throwable> l = getExceptionsAsList(testException); assertThat(l, hasSize(3)); Map<String, Object> info = getExceptionInfo(testException); assertThat(info.entrySet(), hasSize(2)); assertThat(info, hasEntry("info_1", "Imma in!")); assertThat(info, hasEntry("info_2", "Imma out!")); }
private List<Pair<Throwable, ErrorType>> collectCritical(Component obj, MessagingException me, ErrorTypeLocator locator) { List<Pair<Throwable, ErrorType>> errors = new LinkedList<>(); getExceptionsAsList(me).forEach(e -> { ErrorType type = errorTypeFromException(obj, locator, e); if (isCriticalMuleError(type)) { errors.add(new Pair<>(e, type)); } }); return errors; }
private List<Pair<Throwable, ErrorType>> collectErrors(Component obj, MessagingException me, ErrorTypeLocator locator) { List<Pair<Throwable, ErrorType>> errors = new LinkedList<>(); getExceptionsAsList(me).forEach(e -> { ErrorType type = errorTypeFromException(obj, locator, e); if (!isUnknownMuleError(type) && !isCriticalMuleError(type)) { errors.add(new Pair<>(e, type)); } }); return errors; }
@Test public void nestedExceptionRetrieval() throws Exception { Exception testException = getException(); Throwable t = getRootException(testException); assertNotNull(t); assertThat(t.getMessage(), is("blah")); assertThat(t.getCause(), nullValue()); t = getRootMuleException(testException); assertThat(t.getMessage(), is("bar")); assertThat(t.getCause(), not(nullValue())); List<Throwable> l = getExceptionsAsList(testException); assertThat(l, hasSize(3)); Map<String, Object> info = getExceptionInfo(testException); assertThat(info.entrySet(), hasSize(2)); assertThat(info, hasEntry("info_1", "Imma in!")); assertThat(info, hasEntry("info_2", "Imma out!")); }