java - Eclipse throw NullPointerException when running JUnit test -


the version of jdk 7.0.
version of eclipse eclipse-jee-mars-r-win32-x86_64.
version of junit 4.4.

my code follows:

package nn;  import org.junit.test;  public class ofin {         @test        public  void  show(){            system.out.println("cx");        }          @test        public  void  show2(){            system.out.println("cx2");        }        } 

my question when select name of method (for example select show) , run junit test, eclipse throws nullpointerexception.

however, when select name of method and brackets (for example selecting show()) ok, can see result on console. why?

my code simple can't have syntactic error. use older version of eclipse, versions in years after 2014 have problem.

i search , find may version of junit causes problem.then,i try it. abandon add external junit jar(the version 4.4) , write @test in text editing area,then use alt + / let ide add junit4 library,after this,everthing ok.

it's not ide problem,maybe conflict between inner version in eclipse , external version.


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

android - How to create dynamically Fragment pager adapter -

1111. appearing after print sequence - php -