Infinite loops

This example will show how to create an infinite for loop, while and do while. Typically in error an infinite loop occurs when a condition always evaluates to true.

Infinite For Loop

@Ignore("Infinite loop")
@Test
public void infinite_for_loop () {

    for (;;) {
    }
}

Infinite While Loop

@Ignore("Infinite loop")
@Test
public void infinite_while_loop () {

    while (true) {

    }

}

Infinite Do While Loop

@Ignore("Infinite loop")
@Test
public void infinite_do_while_loop () {

    do {

    } while (true);

}