org.jboss.test
Class AbstractTestCase

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

public abstract class AbstractTestCase
extends junit.framework.TestCase

An abstract Test Case.

Version:
$Revision: 56645 $
Author:
Adrian Brock

Constructor Summary
AbstractTestCase(String name)
          Create a new abstract test case
 
Method Summary
protected  void assertEmpty(Collection c)
          Asserts a collection is empty
protected  void assertEmpty(String context, Collection c)
          Asserts a collection is empty
protected  void assertEquals(double one, double two)
          Assert two double values are equal
protected  void assertEquals(float one, float two)
          Assert two float values are equal
protected  void assertEquals(Object[] expected, Object[] actual)
          Assert two arrays are equal
protected  void assertEquals(String context, Object[] expected, Object[] actual)
          Assert two arrays are equal
protected  void checkThrowable(Class expected, Throwable throwable)
          Check we have the expected exception
protected  void configureLogging()
          Callback for configuring logging at the start of the test
protected  Object deserialize(byte[] bytes)
          Serialize an object
protected abstract  void enableTrace(String name)
          Enable trace for a logging category
static URL findResource(Class clazz, String name)
           
abstract  org.jboss.logging.Logger getLog()
          Get the log for this test
 URL getResource(String name)
           
protected  byte[] serialize(Serializable object)
          Serialize an object
protected  void setUp()
           
protected  void tearDown()
           
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractTestCase

public AbstractTestCase(String name)
Create a new abstract test case

Parameters:
name - the test name
Method Detail

getLog

public abstract org.jboss.logging.Logger getLog()
Get the log for this test

Returns:
the log

getResource

public URL getResource(String name)

findResource

public static URL findResource(Class clazz,
                               String name)

setUp

protected void setUp()
              throws Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
Exception

tearDown

protected void tearDown()
                 throws Exception
Overrides:
tearDown in class junit.framework.TestCase
Throws:
Exception

configureLogging

protected void configureLogging()
Callback for configuring logging at the start of the test


enableTrace

protected abstract void enableTrace(String name)
Enable trace for a logging category

Parameters:
name - the logging category

assertEquals

protected void assertEquals(float one,
                            float two)
Assert two float values are equal

Parameters:
one - the expected value
two - the actual value

assertEquals

protected void assertEquals(double one,
                            double two)
Assert two double values are equal

Parameters:
one - the expected value
two - the actual value

assertEquals

protected void assertEquals(Object[] expected,
                            Object[] actual)
Assert two arrays are equal

Parameters:
expected - the expected array
actual - the actual array

assertEquals

protected void assertEquals(String context,
                            Object[] expected,
                            Object[] actual)
Assert two arrays are equal

Parameters:
context - the context
expected - the expected array
actual - the actual array

assertEmpty

protected void assertEmpty(Collection c)
Asserts a collection is empty

Parameters:
c - the collection

assertEmpty

protected void assertEmpty(String context,
                           Collection c)
Asserts a collection is empty

Parameters:
context - the context
c - the collection

checkThrowable

protected void checkThrowable(Class expected,
                              Throwable throwable)
Check we have the expected exception

Parameters:
expected - the excepted class of the exception
throwable - the real exception

serialize

protected byte[] serialize(Serializable object)
                    throws Exception
Serialize an object

Parameters:
object - the object
Returns:
the bytes
Throws:
Exception - for any error

deserialize

protected Object deserialize(byte[] bytes)
                      throws Exception
Serialize an object

Parameters:
bytes - - the raw serialzied object data
Returns:
the bytes
Throws:
Exception - for any error


Copyright © 2004 JBoss Inc. All Rights Reserved.