Skip to content

Commit b534bdf

Browse files
committed
test: Improve VirtualThreadPollerNaiveDeadlockTest assumptions
Fix typo #172
1 parent ac82d08 commit b534bdf

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

junixsocket-common/src/test/java/org/newsclub/net/unix/domain/VirtualThreadPollerNaiveDeadlockTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818
package org.newsclub.net.unix.domain;
1919

20+
import static org.junit.jupiter.api.Assertions.assertEquals;
2021
import static org.junit.jupiter.api.Assertions.assertTrue;
2122

2223
import java.io.BufferedReader;
@@ -97,8 +98,9 @@ protected void onJavaMainClass(String arg) {
9798
}
9899
});
99100

100-
assertTrue(p.waitFor(10, TimeUnit.SECONDS) && p.exitValue() == 0,
101-
"Forked VM should have terminated successfully within a resonable time interval");
101+
assertTrue(p.waitFor(10, TimeUnit.SECONDS),
102+
"Forked VM should have terminated within a resonable time interval");
103+
assertEquals(0, p.exitValue(), "Forked VM should have terminated successfully");
102104
}
103105
}
104106

@@ -122,7 +124,7 @@ private static void reproduce() throws Exception { // NOPMD.CognitiveComplexity
122124
if (!ThreadUtil.isVirtualThreadSupported()) {
123125
throw new TestAbortedNotAnIssueException("Virtual threads not supported");
124126
}
125-
if (ThreadUtil.commonPool().getParallelism() == 1) {
127+
if (ThreadUtil.commonPool().getParallelism() != 1) {
126128
throw new TestAbortedNotAnIssueException(
127129
"Test requires -Djava.util.concurrent.ForkJoinPool.common.parallelism=1");
128130
}

0 commit comments

Comments
 (0)