junit: no tests found

后端 未结 11 891
情书的邮戳
情书的邮戳 2020-12-14 05:47

I have inherited a Java project and am new to Java development. I feel a good way for me to get comfortable with the code is to write some tests around it. I\'m writing my c

11条回答
  •  情话喂你
    2020-12-14 06:02

    Extending junit.framework.TestCase is the old JUnit 3 approach of implementing test cases which doesnt work as no methods start with the letters test. Since you're using JUnit 4, just declare the class as

    public class EmailProviderTest {
    

    and the test method will be found from the @Test annotation.

    Read: JUnit confusion: use 'extend Testcase' or '@Test'?

提交回复
热议问题