Skip to content

Commit b0e3f2d

Browse files
committed
Test DeferredSupplier
1 parent 1808119 commit b0e3f2d

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

platform-tests/src/test/java/org/junit/platform/engine/support/store/NamespacedHierarchicalStoreTests.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,8 +753,26 @@ void getCanBeInterrupted() {
753753
});
754754
assertTrue(Thread.interrupted());
755755
}
756+
757+
@Test
758+
void getOrThrowCanBeInterrupted() {
759+
var supplier = new NamespacedHierarchicalStore.DeferredSupplier(() -> {
760+
try {
761+
Thread.sleep(1000);
762+
}
763+
catch (InterruptedException e) {
764+
throw new ComputeException(e);
765+
}
766+
return value;
767+
});
768+
Thread.currentThread().interrupt();
769+
assertThrows(InterruptedException.class, () -> {
770+
supplier.getOrThrow();
771+
});
772+
assertTrue(Thread.interrupted());
773+
}
756774
}
757-
775+
758776
private static Object createObject(String display) {
759777
return new Object() {
760778

0 commit comments

Comments
 (0)