@Override public void testFailure(final Failure failure) throws Exception { String warnings = warningsCollector.getWarnings(); new JUnitFailureHacker().appendWarnings(failure, warnings); } };
public void appendWarnings(Failure failure, String warnings) { if (isEmpty(warnings)) { return; } //TODO: this has to protect the use in case jUnit changes and this internal state logic fails Throwable throwable = (Throwable) Whitebox.getInternalState(failure, "fThrownException"); String newMessage = "contains both: actual test failure *and* Mockito warnings.\n" + warnings + "\n *** The actual failure is because of: ***\n"; ExceptionIncludingMockitoWarnings e = new ExceptionIncludingMockitoWarnings(newMessage, throwable); e.setStackTrace(throwable.getStackTrace()); Whitebox.setInternalState(failure, "fThrownException", e); }
@Override public void testFailure(final Failure failure) throws Exception { String warnings = warningsCollector.getWarnings(); new JUnitFailureHacker().appendWarnings(failure, warnings); } };
public void appendWarnings(Failure failure, String warnings) { if (isEmpty(warnings)) { return; } //TODO: this has to protect the use in case jUnit changes and this internal state logic fails Throwable throwable = (Throwable) Whitebox.getInternalState(failure, "fThrownException"); String newMessage = "contains both: actual test failure *and* Mockito warnings.\n" + warnings + "\n *** The actual failure is because of: ***\n"; ExceptionIncludingMockitoWarnings e = new ExceptionIncludingMockitoWarnings(newMessage, throwable); e.setStackTrace(throwable.getStackTrace()); Whitebox.setInternalState(failure, "fThrownException", e); }