Not as good or ideal as a mockobject but you could use the GWTTestCase. On Feb 2, 4:19 pm, Kevin Q <[email protected]> wrote: > Our application consumes JSON web services. We're using JSONParser, > returning a JSONObject, and construct domain models from the result > JSONObject. I'd like to test that piece of code, but it seems I cannot > use JSONObject in JVM unit tests, as it depends on native code. > > java.lang.UnsatisfiedLinkError: > com.google.gwt.core.client.JavaScriptObject.createObject()Lcom/google/ > gwt/core/client/JavaScriptObject; > at com.google.gwt.core.client.JavaScriptObject.createObject(Native > Method) > at com.google.gwt.json.client.JSONObject.<init>(JSONObject.java:46) > [output cut...] > > I'm wondering is there a way to mock JSONObject, use a hash map to > hold the key/value pairs, which enables me to run these tests in JVM? > JSONObject is an interface, so EasyMock can't help here. (correct me > if I'm wrong) > > Also, I tried creating a class MockJSONObject extending JSONObject, > and replace the put/get logic with HashMap based implementation but > still no avail, because the JSONObject constructor calls native JS > code as well... > > Any input is appreciated.
-- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
