docs icon indicating copy to clipboard operation
docs copied to clipboard

The JUnit doc page should document a breaking change between JUnit 4 and JUnit 5

Open interrupt-routine opened this issue 7 months ago • 1 comments

Page:

https://docs.codewars.com/languages/java/junit

Problem:

In JUnit 4, the optional message parameter comes first:

assertEquals( "1 + 1 should equal 2", 2, Adder.add(1, 1));

In JUnit 5, it comes last, which breaks compatibility:

assertEquals(2, Adder.add(1, 1), "1 + 1 should equal 2");

Proposed fixes:

  • document the optional message parameter for JUnit 4 (it is currently missing from the sample JUnit 4 tests suite)
  • add a paragraph about that breaking change somewhere in the page

interrupt-routine avatar Apr 21 '25 17:04 interrupt-routine

Honestly, I would remove the example of JUnit 4 completely. It is supported so it can stay mentioned, but example is not necessary since new kata should use JUnit 5 anyway.

Breaking changes between old and new frameworks are usually described on wiki pages with lists of kata to update, and not in docs. Such note will be present on the "List of Java kata to update" when/if JUnit 4 will be removed.

hobovsky avatar Apr 21 '25 21:04 hobovsky