How to test abstract class in Java with JUnit?

后端 未结 10 1234
野趣味
野趣味 2020-11-27 04:46

I am new to Java testing with JUnit. I have to work with Java and I would like to use unit tests.

My problem is: I have an abstract class with some abstract methods.

10条回答
  •  被撕碎了的回忆
    2020-11-27 04:58

    As an option, you can create abstract test class covering logic inside abstract class and extend it for each subclass test. So that in this way you can ensure this logic will be tested for each child separately.

提交回复
热议问题