@Test public void dropNestedCause() { NullPointerException grandChildException = new NullPointerException("Hello Hell!"); RuntimeException childException = new RuntimeException("Hello World!", grandChildException); RuntimeException parentException = new RuntimeException("Hello Heaven!", childException); ThrowableFilter filter = new DropCauseThrowableFilter(RuntimeException.class.getName()); ThrowableData data = filter.filter(new ThrowableWrapper(parentException)); assertThat(data.getClassName()).isEqualTo(RuntimeException.class.getName()); assertThat(data.getMessage()).isEqualTo("Hello Heaven!"); assertThat(data.getStackTrace()).containsExactly(parentException.getStackTrace()); assertThat(data.getCause()).isNull(); }
@Override public ThrowableData filter(final ThrowableData origin) { if (getArguments().isEmpty()) { return new ThrowableStore(origin.getClassName(), origin.getMessage(), origin.getStackTrace(), null); } else { String className = origin.getClassName(); for (String filter : getArguments()) { if (className.equals(filter)) { return new ThrowableStore(origin.getClassName(), origin.getMessage(), origin.getStackTrace(), null); } } return origin; } }
DropCauseThrowableFilter extends AbstractThrowableFilter { @Override public ThrowableData filter(final ThrowableData origin) { if (getArguments().isEmpty()) { return new ThrowableStore(origin.getClassName(), origin.getMessage(), origin.getStackTrace(), null); } else { String className = origin.getClassName(); for (String filter : getArguments()) { if (className.equals(filter)) { return new ThrowableStore(origin.getClassName(), origin.getMessage(), origin.getStackTrace(), null); } } return origin; } } }
DropCauseThrowableFilter extends AbstractThrowableFilter { @Override public ThrowableData filter(final ThrowableData origin) { if (getArguments().isEmpty()) { return new ThrowableStore(origin.getClassName(), origin.getMessage(), origin.getStackTrace(), null); } else { String className = origin.getClassName(); for (String filter : getArguments()) { if (className.equals(filter)) { return new ThrowableStore(origin.getClassName(), origin.getMessage(), origin.getStackTrace(), null); } } return origin; } } DropCauseThrowableFilter();  DropCauseThrowableFilter(final String arguments); }
DropCauseThrowableFilter extends AbstractThrowableFilter { @Override public ThrowableData filter(final ThrowableData origin) { if (getArguments().isEmpty()) { return new ThrowableStore(origin.getClassName(), origin.getMessage(), origin.getStackTrace(), null); } else { String className = origin.getClassName(); for (String filter : getArguments()) { if (className.equals(filter)) { return new ThrowableStore(origin.getClassName(), origin.getMessage(), origin.getStackTrace(), null); } } return origin; } } DropCauseThrowableFilter();  DropCauseThrowableFilter(final String arguments); @Override ThrowableData filter(final ThrowableData origin); }
DropCauseThrowableFilter extends AbstractThrowableFilter { @Override public ThrowableData filter(final ThrowableData origin) { if (getArguments().isEmpty()) { return new ThrowableStore(origin.getClassName(), origin.getMessage(), origin.getStackTrace(), null); } else { String className = origin.getClassName(); for (String filter : getArguments()) { if (className.equals(filter)) { return new ThrowableStore(origin.getClassName(), origin.getMessage(), origin.getStackTrace(), null); } } return origin; } } DropCauseThrowableFilter();  DropCauseThrowableFilter(final String arguments); @Override ThrowableData filter(final ThrowableData origin);  }