GWT: Best practice for unit testing / mocking JSNI methods?

Posted by Epaga on Stack Overflow See other posts from Stack Overflow or by Epaga
Published on 2010-03-30T07:26:04Z Indexed on 2010/03/30 7:43 UTC
Read the original article Hit count: 494

Filed under:
|
|
|
|

I have a class which uses JSNI to retrieve JSON data stored in the host page:

protected native JsArray<JsonModel> getModels() /*-{
    return $wnd.jsonData;
}-*/;

This method is called, and the data is then translated and process in a different method. How should I unit test this class, since I'm not able to instantiate (or seemingly mock?) JsArray?

What is the best way to unit test JSNI methods at all?

© Stack Overflow or respective owner

Related posts about jsni

Related posts about gwt