What's the purpose of the JUnit 5 @Nested annotation

前端 未结 4 1717
故里飘歌
故里飘歌 2021-02-18 21:14

In JUnit 5, there is a new annotation: @Nested.

I understand how it work, I understand why we use nested class, I just don\'t understand why we need to have

4条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-18 21:42

    The @Nested annotation allows you to have an inner class that's essentially a test class, allowing you to group several test classes under the same parent (with the same initialization).

提交回复
热议问题