org.apache.shale.test.base
Class AbstractJsfTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.shale.test.base.AbstractJsfTestCase
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
AbstractViewControllerTestCase

public abstract class AbstractJsfTestCase
extends junit.framework.TestCase

Abstract JUnit test case base class, which sets up the JavaServer Faces mock object environment for a particular simulated request. The following protected variables are initialized in the setUp() method, and cleaned up in the tearDown() method:

In addition, appropriate factory classes will have been registered with javax.faces.FactoryFinder for Application and RenderKit instances. The created FacesContext instance will also have been registered in the apppriate thread local variable, to simulate what a servlet container would do.

WARNING - If you choose to subclass this class, be sure your setUp() and tearDown() methods call super.setUp() and super.tearDown() respectively, and that you implement your own suite() method that exposes the test methods for your test case.


Field Summary
protected  MockApplication application
           
protected  MockServletConfig config
           
protected  MockExternalContext externalContext
           
protected  MockFacesContext facesContext
           
protected  MockFacesContextFactory facesContextFactory
           
protected  MockLifecycle lifecycle
           
protected  MockLifecycleFactory lifecycleFactory
           
protected  MockRenderKit renderKit
           
protected  MockHttpServletRequest request
           
protected  MockHttpServletResponse response
           
protected  MockServletContext servletContext
           
protected  MockHttpSession session
           
 
Constructor Summary
AbstractJsfTestCase(String name)
          Construct a new instance of this test case.
 
Method Summary
protected  void setUp()
          Set up instance variables required by this test case.
protected  void tearDown()
          Tear down instance variables required by this test case.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, 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
 

Field Detail

application

protected MockApplication application

config

protected MockServletConfig config

externalContext

protected MockExternalContext externalContext

facesContext

protected MockFacesContext facesContext

facesContextFactory

protected MockFacesContextFactory facesContextFactory

lifecycle

protected MockLifecycle lifecycle

lifecycleFactory

protected MockLifecycleFactory lifecycleFactory

renderKit

protected MockRenderKit renderKit

request

protected MockHttpServletRequest request

response

protected MockHttpServletResponse response

servletContext

protected MockServletContext servletContext

session

protected MockHttpSession session
Constructor Detail

AbstractJsfTestCase

public AbstractJsfTestCase(String name)

Construct a new instance of this test case.

Parameters:
name - Name of this test case
Method Detail

setUp

protected void setUp()
              throws Exception

Set up instance variables required by this test case.

Overrides:
setUp in class junit.framework.TestCase
Throws:
Exception

tearDown

protected void tearDown()
                 throws Exception

Tear down instance variables required by this test case.

Overrides:
tearDown in class junit.framework.TestCase
Throws:
Exception


Copyright © 2004-2007 Apache Software Foundation. All Rights Reserved.