Hello,

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, 
encodedUrl);
        try {
            expRequestBuilder.sendRequest(null, new RequestCallback() {

                @Override
                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(
ExperimentEntityLite.EXPERIMENT_OID.getAttributeId());
...

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 [email protected].
To post to this group, send email to [email protected].
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