01: /*
02: * Copyright (c) 2002-2006 by OpenSymphony
03: * All rights reserved.
04: */
05:
06: package com.opensymphony.webwork.views.util;
07:
08: /**
09: * <code>ResourceUtilTest</code>
10: *
11: * @author Rainer Hermanns
12: * @version $Id: ResourceUtilTest.java 2393 2006-03-13 05:02:07Z rainerh $
13: */
14: import junit.framework.TestCase;
15: import org.easymock.MockControl;
16:
17: import javax.servlet.http.HttpServletRequest;
18:
19: public class ResourceUtilTest extends TestCase {
20:
21: private MockControl control;
22: private HttpServletRequest requestMock;
23:
24: public void testGetResourceBase() throws Exception {
25: control.expectAndReturn(requestMock.getServletPath(),
26: "/mycontext/");
27: control.replay();
28: assertEquals("/mycontext", ResourceUtil
29: .getResourceBase(requestMock));
30: control.verify();
31:
32: control.reset();
33:
34: control.expectAndReturn(requestMock.getServletPath(),
35: "/mycontext/test.jsp");
36: control.replay();
37: assertEquals("/mycontext", ResourceUtil
38: .getResourceBase(requestMock));
39: control.verify();
40:
41: }
42:
43: protected void setUp() {
44: control = MockControl.createControl(HttpServletRequest.class);
45: requestMock = (HttpServletRequest) control.getMock();
46: }
47: }
|