I get this error when checking with J unit 4 .

My main method.

In the class imported import org.junit.Test;

 @Test public void main(String[] args) { ClientConfig config = new DefaultClientConfig(); Client client = Client.create(config); WebResource resource = client.resource(URL); WebResource one = resource.path(INT_R + integer); WebResource two = resource.path(DOUBLE_R + d); new Service().IntegerValueService(one); } 

Mistake:

 java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=main], {ExactMatcher:fDisplayName=main(appl.test.ApplTest)], {LeadingIdentifierMatcher:fClassName=appl.test.ApplTest,fLeadingIdentifier=main]] from org.junit.internal.requests.ClassRequest@6438a396 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 

    1 answer 1

    You do wrong, there should be no input parameters in the test methods, you can call methods with parameters from the test, use assertions from JUnit to check the expected and actual values. Here's an article for you - http://devcolibri.com/864

    • Andrew, thank you. Say maybe there is a link with settings J Unit only for Eclipse? - Maks.Burkov
    • Do you use maven? If yes, then the same procedure, otherwise I advise you to build a project with a maven - Andrey Sibirkin
    • Andrew, I don’t use Maven and I’m not going to mess with it at the moment .. I already checked my previous project with the J Unit and there was no such problem. "You are doing it wrong, there are no input parameters in the tests" .. Your answer is not clear .. What do you mean there are no input parameters in the tests? - Maks.Burkov
    • Run tests from non-static and non-method parameters? - Maks.Burkov
    • The test should not receive input parameters and, moreover, it should not be static, and if you don’t use maven, just add the jar-nickname JUnit to the project libraries - that’s the whole setup. - Andrey Sibirkin