PageRenderTime 29ms CodeModel.GetById 15ms app.highlight 8ms RepoModel.GetById 2ms app.codeStats 0ms

/plugin-module-codegen-engine/src/main/resources/templates/common/servlet/ServletTest.java.vtl

https://bitbucket.org/mmeinhold/amps
Unknown | 37 lines | 27 code | 10 blank | 0 comment | 0 complexity | a091523d22aec3076019eb593a2bd82a MD5 | raw file
 1package ${PACKAGE};
 2
 3import org.junit.Test;
 4import org.junit.After;
 5import org.junit.Before;
 6import org.mockito.Mockito;
 7
 8import javax.servlet.http.HttpServletRequest;
 9import javax.servlet.http.HttpServletResponse;
10
11import static org.junit.Assert.*;
12import static org.mockito.Mockito.*;
13
14public class ${CLASSNAME} {
15
16    HttpServletRequest mockRequest;
17    HttpServletResponse mockResponse;
18
19    @Before
20    public void setup() {
21        mockRequest = mock(HttpServletRequest.class);
22        mockResponse = mock(HttpServletResponse.class);
23    }
24
25    @After
26    public void tearDown() {
27
28    }
29
30    @Test
31    public void testSomething() {
32        String expected = "test";
33        when(mockRequest.getParameter(Mockito.anyString())).thenReturn(expected);
34        assertEquals(expected,mockRequest.getParameter("some string"));
35
36    }
37}