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

chore: use assertEquals to improve test error message #1470

Merged
merged 5 commits into from
Aug 29, 2024

Conversation

burkedavison
Copy link
Member

Improve test error message to show expected and actual values on failure.

Example of unhelpful assertion message when using assertTrue: https://fusion2.corp.google.com/ci/kokoro/prod:cloud-devrel%2Fclient-libraries%2Fjava%2Fgoogle-auth-library-java%2Fnightly%2Fintegration/activity/210e3a70-92c9-4601-8bcb-49e2a9bf5753/log

[ERROR] com.google.auth.oauth2.PluggableAuthHandlerTest.getExecutableResponse_oidcResponse -- Time elapsed: 0.011 s <<< FAILURE!
java.lang.AssertionError
	at org.junit.Assert.fail(Assert.java:87)
	at org.junit.Assert.assertTrue(Assert.java:42)
	at org.junit.Assert.assertTrue(Assert.java:53)
	at com.google.auth.oauth2.PluggableAuthHandlerTest.getExecutableResponse_oidcResponse(PluggableAuthHandlerTest.java:744)

@burkedavison burkedavison requested a review from a team as a code owner August 15, 2024 13:53
@product-auto-label product-auto-label bot added the size: s Pull request size is small. label Aug 15, 2024
Copy link

@lqiu96 lqiu96 merged commit d62d06e into main Aug 29, 2024
21 checks passed
@lqiu96 lqiu96 deleted the better-assertion-msg branch August 29, 2024 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants