    1   /*
    2    * Copyright 2004-2009 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  package org.seasar.cubby.internal.controller.impl;
    17
    18  import static org.easymock.EasyMock.createMock;
    19  import static org.easymock.EasyMock.createNiceMock;
    20  import static org.easymock.EasyMock.replay;
    21  import static org.easymock.EasyMock.verify;
    22  import static org.junit.Assert.assertSame;
    23
    24  import javax.servlet.http.HttpServletRequest;
    25  import javax.servlet.http.HttpServletResponse;
    26
    27  import org.junit.Test;
    28  import org.seasar.cubby.action.ActionContext;
    29  import org.seasar.cubby.action.ActionResult;
    30  import org.seasar.cubby.internal.controller.ActionResultWrapper;
    31
    32  public class ActionResultWrapperTest {
    33
    34  	@Test
    35  	public void execute() throws Exception {
    36  		HttpServletRequest request = createNiceMock(HttpServletRequest.class);
    37  		HttpServletResponse response = createNiceMock(HttpServletResponse.class);
    38  		ActionResult actionResult = createMock(ActionResult.class);
    39  		ActionContext actionContext = createMock(ActionContext.class);
    40  		actionResult.execute(actionContext, request, response);
    41  		replay(request, response, actionContext, actionResult);
    42
    43  		ActionResultWrapper wrapper = new ActionResultWrapperImpl(actionResult,
    44  				actionContext);
    45  		assertSame(actionResult, wrapper.getActionResult());
    46  		wrapper.execute(request, response);
    47
    48  		verify(request, response, actionContext, actionResult);
    49  	}
    50
    51  }