Commit 8d28268059908bd18e543da7cec6f2ac320f90cf

Authored by Julien Iguchi-Cartigny
1 parent 5e965ce4

fixing tests with servlet path

src/test/java/fr/plil/sio/web/mvc/CheckUserInterceptorTest.java
@@ -22,25 +22,24 @@ public class CheckUserInterceptorTest { @@ -22,25 +22,24 @@ public class CheckUserInterceptorTest {
22 request = new MockHttpServletRequest(); 22 request = new MockHttpServletRequest();
23 response = new MockHttpServletResponse(); 23 response = new MockHttpServletResponse();
24 } 24 }
25 -/* 25 +
26 @Test 26 @Test
27 public void checkPreHandleServletPathIsLogin() throws IOException { 27 public void checkPreHandleServletPathIsLogin() throws IOException {
28 - request.setPathInfo("/login"); 28 + request.setServletPath("/login");
29 assertTrue(interceptor.preHandle(request, response, null)); 29 assertTrue(interceptor.preHandle(request, response, null));
30 } 30 }
31 31
32 @Test 32 @Test
33 public void checkPreHandleUsernameInSession() throws IOException { 33 public void checkPreHandleUsernameInSession() throws IOException {
34 userSession.setUsername("admin"); 34 userSession.setUsername("admin");
35 - request.setPathInfo("/blabla"); 35 + request.setServletPath("/blabla");
36 assertTrue(interceptor.preHandle(request, response, null)); 36 assertTrue(interceptor.preHandle(request, response, null));
37 } 37 }
38 38
39 @Test 39 @Test
40 public void checkPreHandleUsernameNotInSession() throws IOException { 40 public void checkPreHandleUsernameNotInSession() throws IOException {
41 - request.setPathInfo("/blabla"); 41 + request.setServletPath("/blabla");
42 assertFalse(interceptor.preHandle(request, response, null)); 42 assertFalse(interceptor.preHandle(request, response, null));
43 assertEquals(response.getRedirectedUrl(),"login"); 43 assertEquals(response.getRedirectedUrl(),"login");
44 } 44 }
45 - */  
46 } 45 }