JUNIT testing void methods

后端 未结 7 1062
遇见更好的自我
遇见更好的自我 2020-11-27 02:41

I have a java class full of void methods, and I want to make some unit test to get maximal code coverage.

For example I have this method :

protected          


        
7条回答
  •  再見小時候
    2020-11-27 03:17

    If your method is void and you want to check for an exception, you could use expected: https://weblogs.java.net/blog/johnsmart/archive/2009/09/27/testing-exceptions-junit-47

提交回复
热议问题