spring-petclinic icon indicating copy to clipboard operation
spring-petclinic copied to clipboard

test: improve test assertions

Open anyulled opened this issue 11 months ago • 4 comments

  • According to the AssertJ library, the assertThat() method must be followed by an assertion invocation, otherwise what is intended to be a test doesn't actually verify anything.
  • Replacing isEqualTo() with hasToString() assertion increases readability of the code for verifying toString() methods.
  • replacing isNotEqualTo(0) with isNotZero() to improve readability.
  • Replace assertThat(owner6.getPets().size()).isEqualTo(found + 1) with assertThat(owner6.getPets()).hasSize(found + 1); for better code readability.
  • Replace JUnit's assertEqual() assertion with AssertJ assertThat().isEqualTo() for improved readability and consistent use within the project.

solves #1474

anyulled avatar Mar 14 '24 08:03 anyulled

@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.

pivotal-cla avatar Mar 14 '24 08:03 pivotal-cla

@anyulled Thank you for signing the Contributor License Agreement!

pivotal-cla avatar Mar 14 '24 08:03 pivotal-cla

@zyberzebra Who else needs to approve this pull request for merging it?

anyulled avatar Mar 20 '24 16:03 anyulled

One of the Maintainers.

zyberzebra avatar Mar 20 '24 17:03 zyberzebra