net.sf.oness.common.webapp.controller.testing
Class JMockStrutsTestCase

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.jmock.core.VerifyingTestCase
              extended byorg.jmock.core.MockObjectSupportTestCase
                  extended byorg.jmock.MockObjectTestCase
                      extended bynet.sf.oness.common.webapp.controller.testing.JMockStrutsTestCase
All Implemented Interfaces:
junit.framework.Test

public class JMockStrutsTestCase
extends org.jmock.MockObjectTestCase

Base class for Struts testing that mocks Spring ApplicationContext and setups the paths for struts-config.xml file.
By default sets the webapp directory to the system property "maven.war.webapp.dir" and ConfigFile to "WEB-INF/struts/struts-config.xml"

It also allows mock testing with jmock and StrutsTestCase at the same time. Struts operations are available with the struts() method so in the subclasses you can call for example

 struts().setRequestPathInfo(..);
 struts().addRequestParameter(..);
 

Version:
$Revision: 1.3 $
Author:
Carlos Sanchez

Field Summary
 
Fields inherited from class org.jmock.core.MockObjectSupportTestCase
ANYTHING, NOT_NULL, NULL
 
Constructor Summary
JMockStrutsTestCase()
           
JMockStrutsTestCase(java.lang.String name)
           
 
Method Summary
 org.springframework.context.ApplicationContext getApplicationContext()
          Get Spring ApplicationContext
 org.jmock.Mock getMockWebApplicationContext()
          Get mocked Spring WebApplicationContext
protected  void setUp()
           
 servletunit.struts.MockStrutsTestCase struts()
          Get the servletunit.struts.MockStrutsTestCase of this test case
 
Methods inherited from class org.jmock.MockObjectTestCase
atLeastOnce, defaultMockNameForType, mock, mock, never, newCoreMock, once, onConsecutiveCalls, onConsecutiveCalls, onConsecutiveCalls, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, throwException
 
Methods inherited from class org.jmock.core.MockObjectSupportTestCase
and, eq, eq, eq, eq, eq, eq, eq, eq, eq, eq, isA, newDummy, newDummy, newDummy, not, or, same, stringContains
 
Methods inherited from class org.jmock.core.VerifyingTestCase
registerToVerify, runBare, unregisterToVerify, verify
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runTest, setName, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JMockStrutsTestCase

public JMockStrutsTestCase()

JMockStrutsTestCase

public JMockStrutsTestCase(java.lang.String name)
Method Detail

setUp

protected void setUp()
              throws java.lang.Exception
Throws:
java.lang.Exception
See Also:
MockStrutsTestCase.setUp()

getApplicationContext

public org.springframework.context.ApplicationContext getApplicationContext()
Get Spring ApplicationContext

Returns:

getMockWebApplicationContext

public org.jmock.Mock getMockWebApplicationContext()
Get mocked Spring WebApplicationContext

Returns:

struts

public servletunit.struts.MockStrutsTestCase struts()
Get the servletunit.struts.MockStrutsTestCase of this test case

Returns:
servletunit.struts.MockStrutsTestCase


Copyright © 2003-2005 ONess Project. All Rights Reserved.