5b04c2fcc8c1a755429492df1d48886b717bd3f3
[SpringWebServicesForFun/.git] /
1 package de.spring.webservices.endpoints;
2
3 import static org.mockito.Mockito.mock;
4 import static org.mockito.Mockito.verify;
5
6 import org.junit.Before;
7 import org.junit.Test;
8
9 import de.spring.webservices.auto.CustomBindingExampleRequest;
10 import de.spring.webservices.auto.CustomBindingExampleResponse;
11 import de.spring.webservices.auto.ExampleRequest;
12 import de.spring.webservices.operations.Operations;
13 import de.spring.webservices.services.ExampleService;
14
15
16 public class ExampleEndPointTest {
17         
18         private ExampleService exampleService;
19         
20         private Operations.RequestResponse
21         <CustomBindingExampleResponse, CustomBindingExampleRequest> customBindingExampleService;
22         
23         private ExampleEndPoint exampleEndPoint;
24
25         @Before
26     public void init() {
27                 exampleService = mock(ExampleService.class);
28                 customBindingExampleService = mock(Operations.RequestResponse.class);
29                 exampleEndPoint = new ExampleEndPoint(customBindingExampleService, exampleService);
30         }
31         
32         @Test
33         public void givenExampleRequestThenInvokeExampleService() {
34                 ExampleRequest request = new ExampleRequest();
35                 request.setData("SCARLETT");
36         
37                 exampleEndPoint.exampleResponse(request, null, null);
38                 
39                 verify(exampleService).doResponse(request);
40         }
41         
42         @Test
43         public void givenCustomBindingExampleRequestThenInvokeCustomBindingExampleService() {
44                 CustomBindingExampleRequest request = new CustomBindingExampleRequest();
45                 request.setData("SCARLETT");
46         
47                 exampleEndPoint.cuntomBindingExampleResponse(request, null, null);
48                 
49                 verify(customBindingExampleService).requestResponse(request);
50         }
51
52 }