summaryrefslogtreecommitdiffstats
path: root/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/authentication/SessionTimeoutInterceptorTest.java
blob: fc827f783c1595bb5ec39511c25c8b9968bd2348 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package org.openecomp.portalapp.portal.authentication;

import static org.junit.Assert.assertFalse;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.junit.Before;
import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.openecomp.portalapp.authentication.LoginStrategy;
import org.openecomp.portalapp.authentication.SimpleLoginStrategy;
import org.openecomp.portalapp.controller.EPFusionBaseController;
import org.openecomp.portalapp.portal.framework.MockitoTestSuite;
import org.openecomp.portalapp.portal.interceptor.SessionTimeoutInterceptor;
import org.springframework.web.method.HandlerMethod;

public class SessionTimeoutInterceptorTest {

	
	@Mock
	LoginStrategy loginStrategy = new SimpleLoginStrategy();
	
	@Mock
	EPFusionBaseController ePFusionBaseController = new EPFusionBaseController() {
	};
	
	@Mock
	HandlerMethod handlerMethod;
	
	@InjectMocks
	SessionTimeoutInterceptor  sessionTimeoutInterceptor = new  SessionTimeoutInterceptor();

	@Before
	public void setup() {
		MockitoAnnotations.initMocks(this);
	}

	MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();

	HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
	HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
	
	@Test
	public void preHandleTest() throws Exception{
		assertFalse(sessionTimeoutInterceptor.preHandle(mockedRequest, mockedResponse, ePFusionBaseController));
	}
	
	@Test
	public void preHandleTestIfMethodIsinstanceOfHandlerMethod() throws Exception{
		assertFalse(sessionTimeoutInterceptor.preHandle(mockedRequest, mockedResponse, handlerMethod));
	}
}