#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.${subpackage}.client;

import com.google.gwtmockito.GwtMockitoTestRunner;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.Before;

import com.progressoft.brix.domino.api.client.annotations.ClientModule;
import com.progressoft.brix.domino.test.api.client.DominoTestClient;
import com.progressoft.brix.domino.test.api.client.ClientContext;
import ${package}.${subpackage}.client.presenters.${module}Presenter;
import ${package}.${subpackage}.client.requests.${module}ServerRequest;
import ${package}.${subpackage}.shared.request.${module}Request;
import ${package}.${subpackage}.shared.response.${module}Response;
import ${package}.${subpackage}.client.presenters.${module}PresenterSpy;
import ${package}.${subpackage}.client.views.Fake${module}View;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;


@ClientModule(name="Test${module}")
@RunWith(GwtMockitoTestRunner.class)
public class ${module}ClientModuleTest{

    private ${module}PresenterSpy presenterSpy;
    private Fake${module}View fakeView;
    private ClientContext clientContext;

    @Before
    public void setUp() {
        presenterSpy = new ${module}PresenterSpy();
        DominoTestClient.useModules(new ${module}ModuleConfiguration(), new Test${module}ModuleConfiguration())
                .replacePresenter(${module}Presenter.class, presenterSpy)
                .viewOf(${module}Presenter.class, view -> fakeView= (Fake${module}View) view)
                .onStartCompleted(clientContext -> this.clientContext = clientContext)
                .start();
    }

    @Test
    public void given${module}Module_whenContributingToMainExtensionPoint_thenShouldReceiveMainContext() throws Exception {
        assertThat(presenterSpy.getMainContext()).isNotNull();
    }

    @Test
    public void given${module}ClientModule_when${module}ServerRequestIsSent_thenServerMessageShouldBeRecieved() {
        clientContext.forRequest(${module}ServerRequest.class).returnResponse(new ${module}Response("Server message"));

        new ${module}ServerRequest(new ${module}Request("client message")).onSuccess(response -> assertThat(response.getServerMessage()).isEqualTo("Server message"))
        .onFailed(failedResponse -> fail(failedResponse.getError().getMessage()))
        .send();
    }
}

@@ -125,60 +125,8 @@
 t;%0A%0A
-import com.google.gwtmockito.GwtMockitoTestRunner;%0A%0A
 impo
@@ -201,16 +201,67 @@
 .Before;
+%0Aimport com.google.gwtmockito.GwtMockitoTestRunner;
 %0A%0Aimport
@@ -588,29 +588,31 @@
 %7Bmodule%7D
-Server
 Request
+sFactory
 ;%0Aimport
@@ -986,17 +986,16 @@
 .fail;%0A%0A
-%0A
 @ClientM
@@ -1432,24 +1432,16 @@
 tion())%0A
-        
         
@@ -1498,24 +1498,16 @@
 terSpy)%0A
-        
         
@@ -1584,24 +1584,16 @@
 ) view)%0A
-        
         
@@ -1671,24 +1671,16 @@
         
-       
- 
 .start()
@@ -1806,25 +1806,8 @@
 xt()
- throws Exception
  %7B%0A 
@@ -2045,28 +2045,65 @@
 ule%7D
-ServerRequest.class)
+RequestsFactory.$%7Bmodule%7DRequests_request.class)%0A        
 .ret
@@ -2165,20 +2165,16 @@
         
-new 
 $%7Bmodule
@@ -2170,31 +2170,50 @@
    $%7Bmodule%7D
-ServerR
+RequestsFactory.INSTANCE.r
 equest(new $

change the generated module request to use RequestFactory