jackson-databind icon indicating copy to clipboard operation
jackson-databind copied to clipboard

Apply JUnit5 best practices

Open timo-a opened this issue 1 year ago • 4 comments

This PR applies JUnit best practices (via OpenRewrite recipes). For ease of review the changes are grouped into separate commits:

  1. Remove public modifier from test classes and methods
  2. Extract inner class Employee that is used in another package into its own class. This way its original class TestObjectId which contains tests and several inner classes can have its public modifier removed.
  3. Remove "test" prefix from test methods as that is no longer required
  4. Adapt assert in JDKStringLikeTypeDeserTest::stackTraceElement. Not sure what the test does but apparently it references the name of the test method which has now changed.
  5. Use static imports for Assertions, so you don't have Assertios.assertXY in the code all the time but assertXY directly. Also replace star import with explicit assertions where appropriate.
  6. Make assertions more concise e.g. assertEquals(false, p.value) -> assertFalse(p.value)
  7. Revert above conversion for array builder class where equals is not symmetric (it is compared with an actual array -> different type)
  8. Use explicit asserts for exception instead of fails in a catch block.
  9. Remove unused imports.

timo-a avatar Oct 22 '24 08:10 timo-a