Skip to content

Commit 30bd292

Browse files
authored
run unit tests without fork (#7)
1 parent a0560dd commit 30bd292

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

httpserver/src/test/java/esa/httpserver/utils/LoggedThreadFactoryTest.java

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import esa.commons.concurrent.InternalThread;
1919
import org.junit.jupiter.api.Test;
2020

21-
import static org.junit.jupiter.api.Assertions.assertEquals;
2221
import static org.junit.jupiter.api.Assertions.assertFalse;
2322
import static org.junit.jupiter.api.Assertions.assertTrue;
2423

@@ -29,26 +28,14 @@ void testNewThread() {
2928
LoggedThreadFactory factory = new LoggedThreadFactory("foo", true);
3029
Thread thread = factory.newThread(() -> {
3130
});
32-
assertEquals("foo-0#0", thread.getName());
33-
assertTrue(thread.isDaemon());
34-
assertTrue(thread instanceof InternalThread);
35-
36-
thread = factory.newThread(() -> {
37-
});
38-
assertEquals("foo-0#1", thread.getName());
31+
assertTrue(thread.getName().startsWith("foo"));
3932
assertTrue(thread.isDaemon());
4033
assertTrue(thread instanceof InternalThread);
4134

4235
factory = new LoggedThreadFactory("bar");
4336
thread = factory.newThread(() -> {
4437
});
45-
assertEquals("bar-1#0", thread.getName());
46-
assertFalse(thread.isDaemon());
47-
assertTrue(thread instanceof InternalThread);
48-
49-
thread = factory.newThread(() -> {
50-
});
51-
assertEquals("bar-1#1", thread.getName());
38+
assertTrue(thread.getName().startsWith("bar"));
5239
assertFalse(thread.isDaemon());
5340
assertTrue(thread instanceof InternalThread);
5441
}

pom.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,6 @@
225225
<include>**/*Tests.java</include>
226226
</includes>
227227
<excludes>${excludes-tests}</excludes>
228-
<forkCount>4</forkCount>
229-
<reuseForks>false</reuseForks>
230228
</configuration>
231229
</plugin>
232230
<plugin>

0 commit comments

Comments
 (0)