I have created the following utility method, which gives me access to 
RequestFactory for Unit Tests.

public class RequestFactoryProvider {

    public static AppRequestFactory get() {
        ServiceLayer serviceLayer = ServiceLayer.create();
        SimpleRequestProcessor processor = new 
SimpleRequestProcessor(serviceLayer);
        EventBus eventBus = new SimpleEventBus();
        AppRequestFactory requestFactory = 
RequestFactoryMagic.create(AppRequestFactory.class);
        requestFactory.initialize(eventBus, new 
InProcessRequestTransport(processor));
        return requestFactory;
    }


}



You can then use it like below in your tests:

public class xxxTests {

     AppRequestFactory requestFactory;

    @Before
    public void setUp() throws Exception {
        requestFactory = RequestFactoryProvider.get();
    }

}

-- 
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.

Reply via email to