re: Why You Should Start Using JUnit 5 VIEW POST


Why they added a @DisplayName and didn't add a param to @test like @test (name = "it should not fails")?


Ha! That's a very good question that I just recently asked Sam Brannon, one of the core committers of JUnit 5. :)

His answer goes as follows:

  • There are other "things" that support @DisplayName like test class (as shown in my example), @TestFactory, @RepeatedTest, @ParameterizedTest and @TestTemplate. Having @DisplayName orthogonal to those features is just about separating concern.
  • If JUnit would have a concept like @AliasFor meta annotations in spring, ´this would still be possible (but it doesn't)
  • You could write your own custom composed annotation
code of conduct - report abuse