1   /*
2    * Copyright 2004-2010 the Seasar Foundation and the Others.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  
17  package org.seasar.cubby.internal.controller.impl;
18  
19  import static org.easymock.EasyMock.createMock;
20  import static org.easymock.EasyMock.createNiceMock;
21  import static org.easymock.EasyMock.replay;
22  import static org.easymock.EasyMock.verify;
23  import static org.junit.Assert.assertSame;
24  
25  import javax.servlet.http.HttpServletRequest;
26  import javax.servlet.http.HttpServletResponse;
27  
28  import org.junit.Test;
29  import org.seasar.cubby.action.ActionContext;
30  import org.seasar.cubby.action.ActionResult;
31  import org.seasar.cubby.internal.controller.ActionResultWrapper;
32  
33  public class ActionResultWrapperTest {
34  
35  	@Test
36  	public void execute() throws Exception {
37  		HttpServletRequest request = createNiceMock(HttpServletRequest.class);
38  		HttpServletResponse response = createNiceMock(HttpServletResponse.class);
39  		ActionResult actionResult = createMock(ActionResult.class);
40  		ActionContext actionContext = createMock(ActionContext.class);
41  		actionResult.execute(actionContext, request, response);
42  		replay(request, response, actionContext, actionResult);
43  
44  		ActionResultWrapper wrapper = new ActionResultWrapperImpl(actionResult,
45  				actionContext);
46  		assertSame(actionResult, wrapper.getActionResult());
47  		wrapper.execute(request, response);
48  
49  		verify(request, response, actionContext, actionResult);
50  	}
51  
52  }