I wanted to know if it could be possible to Mock out the response.getText() 
in a callback when using RequestBuilder. This way I can write tests to 
simulate the responses etc.

 RequestBuilder expRequestBuilder = new RequestBuilder(RequestBuilder.GET, 
        try {
            expRequestBuilder.sendRequest(null, new RequestCallback() {

                public void onResponseReceived(final Request request, final 
Response response) {
                    if (response.getStatusCode() == Response.SC_OK) {
                        String json = response.getText();
                        //populate the map with the data we retrieve
                        JsArray<EntityLite> array = evalJsonGetData("(" + 
json + ")");
                        for (int i = 0; i < array.length(); i++) {
                            EntityLite entity = array.get(i);
                            String oid = entity.getValue(

The above shows the code which is inside a method inside a class. I thought 
maybe I could pass in the RequestBuilder as a mock but I don't think that 
will work as I want to exercise the code inside onResponseReceived

I didn't find examples unfortunately in the framework for this simple kind 
of testing.

Many thanks

You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to