i have been looking @ hour , can't seem see what's wrong.
jsonobject jsonresponse = new jsonobject(); jsonresponse.put("json", "hi"); string mystring = jsonresponse.getstring("json"); assertequals("hi", mystring);
result... (the entire method throws throwable). tried try/catch well. same result....
java.lang.assertionerror: expected :hi actual :null
this class using
public class ecusertests(){ @org.junit.test public void testuserexists(){ try{ jsonobject jsonresponse = new jsonobject(); jsonresponse.put("json", "hello, world!"); string mystring = jsonresponse.getstring("json"); assertequals("hi", mystring); }catch(jsonexception e){ e.printstacktrace(); }
i suppose you're running unit test outside of android , compiling against android.jar
. lib contains class , interface signatures without implementation.
solution:
either execute unit test in android context (not on pc) or when running on pc, have load "real" json library test.
Comments
Post a Comment