junit4 - java.lang.RuntimeException: Stub! running Junit in Android project -


in android project try run simple junit tests. fail with:

java.lang.runtimeexception: stub! @ org.apache.http.impl.client.abstracthttpclient.<init>(abstracthttpclient.java:5) @ org.apache.http.impl.client.defaulthttpclient.<init>(defaulthttpclient.java:7) @ com.my.android.jsonparser.getjsonfromurl(jsonparser.java:27) @ com.my.android.test.jsonparser_test.getjson(jsonparser_test.java:19) 

this line fails, new class initiation that.

 public jsonobject getjsonfromurl(string url) {         defaulthttpclient httpclient = new defaulthttpclient();         ...  } 

in several posts found junit jar should included before android sdk. did in intellij, did not help. using junit 4.9 , android sdk 4.2.2

i think robolectric can useful you.

running tests on android emulator or device slow! building, deploying, , launching app takes minute or more. that’s no way tdd. there must better way.

wouldn’t nice run android tests directly inside ide? perhaps you’ve tried, , been thwarted dreaded 'java.lang.runtimeexception: stub!'?

http://pivotal.github.com/robolectric/


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -