01: /*
02: * Copyright (c) 2002-2003 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.webwork.interceptor;
06:
07: import javax.servlet.http.HttpServletRequest;
08:
09: import org.jmock.Mock;
10: import org.jmock.core.constraint.IsEqual;
11: import org.jmock.core.matcher.InvokeOnceMatcher;
12:
13: import com.opensymphony.webwork.ServletActionContext;
14: import com.opensymphony.webwork.WebWorkTestCase;
15: import com.opensymphony.xwork.mock.MockActionInvocation;
16:
17: /**
18: * Test case for CreateSessionInterceptor.
19: *
20: * @author tm_jee
21: * @version $Date: 2006-03-04 16:07:50 +0100 (Sat, 04 Mar 2006) $ $Id: CreateSessionInterceptorTest.java 2308 2006-03-04 15:07:50Z rainerh $
22: */
23: public class CreateSessionInterceptorTest extends WebWorkTestCase {
24:
25: public void testCreateSession() throws Exception {
26: Mock httpServletRequestMock = new Mock(HttpServletRequest.class);
27: httpServletRequestMock.expects(new InvokeOnceMatcher()).method(
28: "getSession").with(new IsEqual(Boolean.TRUE));
29: HttpServletRequest request = (HttpServletRequest) httpServletRequestMock
30: .proxy();
31:
32: ServletActionContext.setRequest(request);
33:
34: CreateSessionInterceptor interceptor = new CreateSessionInterceptor();
35: interceptor.intercept(new MockActionInvocation());
36:
37: httpServletRequestMock.verify();
38: }
39: }
|