Skip to content

Commit

Permalink
Update ErrorCollector.addError() to check for null
Browse files Browse the repository at this point in the history
  • Loading branch information
kcooney committed Dec 5, 2016
1 parent 88f63da commit ac273c0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/org/junit/rules/ErrorCollector.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ protected void verify() throws Throwable {
* Adds a Throwable to the table. Execution continues, but the test will fail at the end.
*/
public void addError(Throwable error) {
if (error == null) {
throw new NullPointerException("Error cannot be null");
}
if (error instanceof AssumptionViolatedException) {
AssertionError e = new AssertionError(error.getMessage());
e.initCause(error);
Expand Down

0 comments on commit ac273c0

Please sign in to comment.