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

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -