gwt-test-utils / gwt-test-utils

gwt-test-utils is a Java framework that allows to test GWT client side code in a efficient, easy way
125 stars 49 forks source link

Add support for containsKey in JSONObject #34

Closed kesse closed 11 years ago

kesse commented 11 years ago

JSONObject don't support containsKey.

java.lang.UnsatisfiedLinkError: com.google.gwt.json.client.JSONObject.containsKey(Ljava/lang/String;)Z
    at com.google.gwt.json.client.JSONObject.containsKey(Native Method)
    at se.surikat.dashboard.client.JSONHelper.getJSONValueFromJSONObject(JSONHelper.java:65)
    at se.surikat.dashboard.client.JSONHelper.getJSONObjectFromJSONObject(JSONHelper.java:83)
    at se.surikat.dashboard.client.JSONHelper.getDimensionField(JSONHelper.java:13)
    at se.surikat.dashboard.client.JSONHelperTest.testGetDimensionNotAString(JSONHelperTest.java:124)

Have made a fix in JSONObjectParser

@PatchMethod
static boolean containsKey(JSONObject jsonObject, String key) {
Map<String, JSONValue> map = getInnerMap(jsonObject);
  return map.containsKey(key);
}

which solves the problem

buildhive commented 11 years ago

gwt-test-utils » gwt-test-utils #112 SUCCESS This pull request looks good (what's this?)

Gael commented 11 years ago

Thank you very much ! It would be great if you could complete JSONObjectTest with a small unit test to validate the containsKey method ;) (well, I could do it myself if you don't want to)

buildhive commented 11 years ago

gwt-test-utils » gwt-test-utils #113 SUCCESS This pull request looks good (what's this?)

kesse commented 11 years ago

Sorry that I missed the test, will create it tomorrow.