org.jboss.test
Class AbstractTestCaseWithSetup

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.jboss.test.AbstractTestCase
              extended by org.jboss.test.AbstractTestCaseWithSetup
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
JBossTestCase

public class AbstractTestCaseWithSetup
extends AbstractTestCase

An extension of AbstractTestCase that adds AbstractTestDelegate and AbstractTestSetup delegate notions. The AbstractTestSetup integrates with the junit.extensions.TestSetup setUp/tearDown callbacks to create an AbstractTestDelegate. When a testcase is run as a class with all conforming unit test methods run, a single class wide AbstractTestDelegate is created by either the fist call to the setUp method, or the suite AbstractTestSetup wrapper created by suite(Class).

Version:
$Revision: 62649 $
Author:
Adrian Brock, Scott.Stark@jboss.org

Constructor Summary
AbstractTestCaseWithSetup(String name)
          Create a new test case
 
Method Summary
protected  void enableTrace(String name)
          Enable trace logging for the given category name.
protected  AbstractTestDelegate getDelegate()
          Get the delegate
 org.jboss.logging.Logger getLog()
          Get the jboss logger.
static void resumeSecurity(SecurityManager securityManager)
          Resume / set security manager.
protected  void setUp()
          Create a AbstractTestSetup wrapper for this class/instance to initialize the AbstractTestDelegate if the AbstractTestSetup.delegate singleton has not been initialized.
static junit.framework.Test suite(Class clazz)
          Bootstrap the test for the case of running all tests in clazz.
static SecurityManager suspendSecurity()
          Suspend security manager.
protected  void tearDown()
           
 
Methods inherited from class org.jboss.test.AbstractTestCase
assertEmpty, assertEmpty, assertEmpty, assertEquals, assertEquals, assertEquals, assertEquals, assertInstanceOf, assertInstanceOf, checkDeepThrowable, checkDeepThrowableRethrow, checkThrowable, checkThrowableRethrow, configureLogging, deserialize, failure, findResource, getResource, serialize, serializeDeserialize
 
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, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractTestCaseWithSetup

public AbstractTestCaseWithSetup(String name)
Create a new test case

Parameters:
name - the test name
Method Detail

getLog

public org.jboss.logging.Logger getLog()
Get the jboss logger.

Specified by:
getLog in class AbstractTestCase
Returns:
the log

enableTrace

protected void enableTrace(String name)
Enable trace logging for the given category name.

Specified by:
enableTrace in class AbstractTestCase
Parameters:
name - - the logging category to enable trace level logging for.

getDelegate

protected AbstractTestDelegate getDelegate()
Get the delegate

Returns:
the delegate

setUp

protected void setUp()
              throws Exception
Create a AbstractTestSetup wrapper for this class/instance to initialize the AbstractTestDelegate if the AbstractTestSetup.delegate singleton has not been initialized.

Overrides:
setUp in class AbstractTestCase
Throws:
Exception

tearDown

protected void tearDown()
                 throws Exception
Overrides:
tearDown in class AbstractTestCase
Throws:
Exception

suite

public static junit.framework.Test suite(Class clazz)
Bootstrap the test for the case of running all tests in clazz. This creates an AbstractTestSetup wrapper around TestSuite(clazz) to initialize the AbstractTestDelegate once for the suite.

Parameters:
clazz - the test class
Returns:
the bootstrap wrapper test

suspendSecurity

public static SecurityManager suspendSecurity()
Suspend security manager.

Returns:
current security manager instance

resumeSecurity

public static void resumeSecurity(SecurityManager securityManager)
Resume / set security manager.

Parameters:
securityManager - security manager to set


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.