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
test: improve test assertions #1473
Conversation
@anyulled Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@anyulled Thank you for signing the Contributor License Agreement! |
src/test/java/org/springframework/samples/petclinic/model/ValidatorTests.java
Outdated
Show resolved
Hide resolved
src/test/java/org/springframework/samples/petclinic/owner/OwnerControllerTests.java
Show resolved
Hide resolved
src/test/java/org/springframework/samples/petclinic/service/ClinicServiceTests.java
Outdated
Show resolved
Hide resolved
src/test/java/org/springframework/samples/petclinic/system/CrashControllerTests.java
Show resolved
Hide resolved
…datorTests.java Co-authored-by: zral <73640367+zyberzebra@users.noreply.github.com>
…inicServiceTests.java Co-authored-by: zral <73640367+zyberzebra@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 🤘🏼🔥
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good :)
@zyberzebra Who else needs to approve this pull request for merging it? |
One of the Maintainers. |
assertThat()
method must be followed by an assertion invocation, otherwise what is intended to be a test doesn't actually verify anything.isEqualTo()
withhasToString()
assertion increases readability of the code for verifyingtoString()
methods.isNotEqualTo(0)
withisNotZero()
to improve readability.assertThat(owner6.getPets().size()).isEqualTo(found + 1)
withassertThat(owner6.getPets()).hasSize(found + 1);
for better code readability.assertEqual()
assertion with AssertJassertThat().isEqualTo()
for improved readability and consistent use within the project.solves #1474