We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aec423b commit 84bbc86Copy full SHA for 84bbc86
1 file changed
src/test/java/org/apache/commons/io/ThreadMonitorTestCase.java
@@ -18,6 +18,7 @@
18
19
import static org.junit.jupiter.api.Assertions.assertNull;
20
import static org.junit.jupiter.api.Assertions.fail;
21
+import static org.junit.jupiter.api.Assertions.assertThrows;
22
23
import java.time.Duration;
24
@@ -80,13 +81,10 @@ public void testNoTimeoutZero() {
80
81
*/
82
@Test
83
public void testTimeout() {
- try {
84
+ assertThrows(InterruptedException.class, () -> {
85
final Thread monitor = ThreadMonitor.start(Duration.ofMillis(100));
86
TestUtils.sleep(400);
87
ThreadMonitor.stop(monitor);
- fail("Expected InterruptedException");
88
- } catch (final InterruptedException e) {
89
- // expected result - timeout
90
- }
+ });
91
}
92
0 commit comments