I have got a problem connected with JSONObject.
@Test
public void toUrlTest() throws JSONException {
String url;
JSONObject json = new JSONObject();
json.put"id", 1);
json.put("email", "[email protected]");
url = JSONParser.toURLString(json);
assertEquals("id=1&[email protected]", url);
}
The problem is when I am debugging this test, it shows that nothing is put to json object.
json={org.json.JSONObject@826} "null"
I checked everything and I got no clue why this happen. JSONObject works fine in app. It only happens while testing.
PS.
I have added in build.gradle this
testOptions {
unitTests.returnDefaultValues = true
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…