Junit单元测试报错如下:
java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=demo1], {ExactMatcher:fDisplayName=demo1(offer.longestCommonPrefix)], {LeadingIdentifierMatcher:fClassName=offer.longestCommonPrefix,fLeadingIdentifier=demo1]] from org.junit.internal.requests.ClassRequest@f970646
at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:40)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createFilteredTest(JUnit4TestLoader.java:77)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:68)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:43)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
代码:
package offer;
import org.junit.Test;
public class longestCommonPrefix {
@Test
private void demo1() {
System.out.println("hello");
}
}