问答式问题,因为现有问题与我在此处输入的简单错字不符:
目标
问题
代码
import org.junit.jupiter.api.Test;
public class Test {
@Test
private void testAMethod() { (...) }
}
最佳答案
改成
public void testAMethod() { (...) }
根据 Junit5 文档
Test classes, test methods, and lifecycle methods are not required to be public, but they must not be private.
https://junit.org/junit5/docs/current/user-guide/
关于intellij-idea - "No tests were found"使用 Junit 5 和 IntelliJ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59288305/