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

Mismatch reporting should include actual events #21

Open
marcphilipp opened this issue Dec 23, 2020 · 0 comments
Open

Mismatch reporting should include actual events #21

marcphilipp opened this issue Dec 23, 2020 · 0 comments

Comments

@marcphilipp
Copy link

Currently, when an assertion fails the exception message only includes the expectation, but not the actual events.

For example, the following assertion inspired by the JUnit 5 codebase fails with AssertionError: No JFR event of type <org.junit.EngineDiscovery> with attributes <{uniqueId=[engine:does-not-exist]}>:

assertThat(jfrEvents)
	.contains(event("org.junit.EngineDiscovery")
		.with("uniqueId", "[engine:does-not-exist]"));

To find out what went wrong, I then had to add println statements to the test code, e.g.

		jfrEvents.filter(event -> "org.junit.EngineDiscovery".equals(event.getEventType().getName()))
				.forEach(System.out::println);

It would be great if the assertion message would include a (possibly shortened) list of actual events of the event type in question.

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

No branches or pull requests

1 participant