JUnit 的问题

Trouble with JUnit

每当我创建一个新的 JUnit 测试用例时,它都会像这样生成:

import junit.framework.TestCase;


public class Test extends TestCase {

}

但这不正确。甚至没有生成 @Test,当我将它放入自己时,出现类型不匹配错误(无法从 Test 转换为注释)。有帮助吗?

编辑:

import static org.junit.Assert.*;


public class Test {

    @org.junit.Test
    public void test() {
        fail("Not yet implemented");
    }

}

您使用的 JUnit 版本不正确。检查您使用的版本。注解在 JUnit 4 中可用,在 JUnit 3 中不可用