Skip to content

Commit

Permalink
Add test for interlocked recursive structures
Browse files Browse the repository at this point in the history
  • Loading branch information
marcphilipp authored and sormuras committed Jan 20, 2020
1 parent 09fa8e3 commit 51491b9
Showing 1 changed file with 11 additions and 0 deletions.
Expand Up @@ -16,10 +16,12 @@
import static org.junit.jupiter.api.AssertionTestUtils.expectAssertionFailedError;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertIterableEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.IterableFactory.listOf;
import static org.junit.jupiter.api.IterableFactory.setOf;

import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

Expand Down Expand Up @@ -449,4 +451,13 @@ void assertIterableEqualsWithListOfPath() {
assertDoesNotThrow(() -> assertIterableEquals(expected, actual));
}

@Test
void assertIterableEqualsThrowsStackOverflowErrorForInterlockedRecursiveStructures() {
var expected = new ArrayList<>();
var actual = new ArrayList<>();
actual.add(expected);
expected.add(actual);
assertThrows(StackOverflowError.class, () -> assertIterableEquals(expected, actual));
}

}

0 comments on commit 51491b9

Please sign in to comment.