Issue with running JUnit test with @Test on Android. Expected annotation not working -


i use eclipse , added junit4 in libraries. have test expect exceptions , use @test annotations parameters this:

@test(expected = nullpointerexception.class) public void setnullclassloader() {     noob.setclassloader(null); } 

but not working. don't complete test, "test failed" exception nullpointerexception. example of test result:

java.lang.illegalargumentexception: illegal return count @ com.naef.jnlua.luastate.lua_pcall(native method) @ com.naef.jnlua.luastate.call(luastate.java:591) @ com.example.testlualib.tests.luastateerrortest.testillegalcall2(luastateerrortest.java:256) @ android.test.androidtestrunner.runtest(androidtestrunner.java:191) @ android.test.androidtestrunner.runtest(androidtestrunner.java:176) @ android.test.instrumentationtestrunner.onstart(instrumentationtestrunner.java:555) @ android.app.instrumentation$instrumentationthread.run(instrumentation.java:1873) 

all tests extends androidtestcase, add @runwith(junit4.class) annotation main test class:

@runwith(junit4.class) public abstract class abstractluatest extends androidtestcase { ... } 

if want run junit 4 test (with nice annotations) must not extend androidtestcase. please remove @runwith(junit4.class), too. runner deprecated. should use default runner not need @runwith annotation.

public abstract class abstractluatest {     ... } 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -