test/java/lang/Throwable/SuppressedExceptions.java
Print this page
@@ -191,10 +191,11 @@
Throwable suppressed = new ArithmeticException();
t = new NoSuppression(true); // Suppression enabled
// Make sure addSuppressed(null) throws an NPE
try {
t.addSuppressed(null);
+ throw new RuntimeException("NPE not thrown!");
} catch(NullPointerException e) {
; // Expected
}
t.addSuppressed(suppressed);
t0 = t.getSuppressed();
@@ -202,9 +203,9 @@
throw new RuntimeException("Expected suppression did not occur.");
}
private static class NoSuppression extends Throwable {
public NoSuppression(boolean enableSuppression) {
- super("The medium.", null, enableSuppression);
+ super("The medium.", null, enableSuppression, true);
}
}
}