Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assertIterableEquals: StackOverflow for self-iterating Iterable #2915

Closed
1 task done
thomaszub opened this issue May 13, 2022 · 0 comments · Fixed by #2916
Closed
1 task done

assertIterableEquals: StackOverflow for self-iterating Iterable #2915

thomaszub opened this issue May 13, 2022 · 0 comments · Fixed by #2916

Comments

@thomaszub
Copy link
Contributor

thomaszub commented May 13, 2022

assertIterableEqualscan lead to a StackOverflowError for Path or general for Iterable that iterates over itself. This is similar to the issue #2157. The PR to this issue fixes the success case only.

I created a PR with a possible fix and test.

Steps to reproduce

@Test
void assertIterableEqualsWithDifferentListOfPath() {
	try {
		var expected = listOf(Path.of("1"), Path.of("2").resolve("3"), Path.of("5"));
		var actual = listOf(Path.of("1"), Path.of("2").resolve("4"), Path.of("5"));
		assertIterableEquals(expected, actual);
		expectAssertionFailedError();
	}
	catch (AssertionFailedError ex) {
		assertMessageEquals(ex, "iterable contents differ at index [1][1][0], expected: <3> but was: <4>");
	}
}

Context

  • Used versions (Jupiter/Vintage/Platform): junit-jupiter-api/junit-jupiter-engine 5.8.2
  • Build Tool/IDE: Maven

Deliverables

  • Provide fix and test for comparing Iterable<? extends Iterable<?>> instances.

I hereby agree to the terms of the JUnit Contributor License Agreement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants