Skip to content

Commit b816546

Browse files
committed
bug: #41
Tests to assert behavior of correction for the bug
1 parent 8dbd622 commit b816546

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/test/java/javascalautils/concurrent/TestPromiseImpl.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,17 @@ public void tryFailure_twice() {
165165
assertFalse(promise.tryFailure(new Exception("Scheit, another exception")));
166166
}
167167

168+
@Test
169+
public void future_listenerThrowsExceptionOnComplete() {
170+
promise.future().onSuccess(s -> {
171+
//simulates an application that misbehaves and throws an exception when in the event/result listener
172+
throw new NullPointerException("Null sucks!!!");
173+
});
174+
175+
//should yield nothing to us even though the result listener throws an exception
176+
promise.success("Yippikaye!!!");
177+
}
178+
168179
@Test
169180
public void t_toString() {
170181
assertNotNull(promise.toString());

0 commit comments

Comments
 (0)