-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Description
Hello, I didn't find this issue reported.
On JUnit 5 (5.3.1.v20181005-1442) and also in JUnit 4 (4.12.0.v201504281640), when running the test below on eclipse (Version: 2018-12 (4.10.0) Build id: 20181214-0600) on Ubuntu 18.04, the timeout rule fails to stop de test.
@Rule
public Timeout globalTimeout = Timeout.millis(1000);
@Test
void test() {
NaughtyList list = new NaughtyList();
list.add(1);
}
For the following class
public class NaughtyList {
public static class NaughtyNode {
public int value;
public NaughtyNode next;
}
private NaughtyNode header;
public NaughtyList() {
header = new NaughtyNode();
header.value = Integer.MIN_VALUE;
}
public void add(int elem) {
NaughtyNode current = header;
while(true) {
current.next = new NaughtyNode();
current = current.next;
current.value = elem;
}
}
}
I know that this is an extreme case but I found this issue when doing some mutation testing experiments and some mutants caused an infinite loop on a very simple code that kept creating new objets.