You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Test
public void shouldApplyThrowingCheckedConsumer() {
final CheckedConsumer<?> f = t -> { throw new Error(); };
try {
f.accept(null);
fail("should have thrown");
} catch(Throwable x) {
// ok
}
}
Since AssertionError is-a Throwable, this test would pass, even if f.accept() didn't throw an error. I don't know how many instances of this problem there are throughout the code base.
On the one hand, it seems impossible to cause this problem in this context; however, the general pattern is a mistake.
The text was updated successfully, but these errors were encountered:
Example:
Since
AssertionError
is-aThrowable
, this test would pass, even iff.accept()
didn't throw an error. I don't know how many instances of this problem there are throughout the code base.On the one hand, it seems impossible to cause this problem in this context; however, the general pattern is a mistake.
The text was updated successfully, but these errors were encountered: