junit.com.mcdermottroe.exemplar
Class ExceptionClassTestCase<T extends Exception>

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by junit.com.mcdermottroe.exemplar.ExemplarTestCase<T>
              extended by junit.com.mcdermottroe.exemplar.NormalClassTestCase<Exception>
                  extended by junit.com.mcdermottroe.exemplar.ExceptionClassTestCase<T>
Type Parameters:
T - The type of Exception being tested.
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
CopyExceptionTest, InputExceptionTest, LexerExceptionTest, MessageExceptionTest, OutputExceptionTest, ParameterEntityExceptionTest, ParserExceptionTest, XMLDocumentTypeExceptionTest, XMLParserGeneratorExceptionTest

public abstract class ExceptionClassTestCase<T extends Exception>
extends NormalClassTestCase<Exception>

Test class for all exception classes.

Since:
0.1

Field Summary
 
Fields inherited from class junit.com.mcdermottroe.exemplar.NormalClassTestCase
allowPublicStaticMembers, ignoreHashCodeTests
 
Fields inherited from class junit.com.mcdermottroe.exemplar.ExemplarTestCase
DELIBERATE_PASS, testedClass, TMP
 
Constructor Summary
ExceptionClassTestCase()
           
 
Method Summary
protected  Exception sampleFromNoArgConstructor()
          Create a sample object using the no-arg constructor.
protected  Exception sampleFromStringConstructor()
          Create a sample object using the String constructor.
protected  Exception sampleFromStringThrowableConstructor()
          Create a sample object using the String, Throwable constructor.
protected  Exception sampleFromThrowableConstructor()
          Create a sample object using the Throwable constructor.
 void setUp()
          Set up the JUnit test.
 void testGetBackTrace()
          Test the method Exception.getBackTrace() on a set of sample objects.
 void testInheritsFromExemplarException()
          Test to ensure that Exception classes inherit from Throwable via the exemplar version of Exception rather than from the standard Exception.
 void testNoArgConstructor()
          Test that a no-arg constructor is available and can be used to create an instance of the Exception class.
 void testOneStringConstructor()
          Test that a constructor which takes a single argument of type String is available and can be used to create an instance of the Exception class.
 void testOneThrowableConstructor()
          Test that a constructor which takes a single argument of type Throwable is available and can be used to create an instance of the Exception class.
 void testStringThrowableConstructor()
          Test that a constructor which takes two arguments, a String and a Throwable in that order, is available and can be used to create an instance of the Exception class.
 void testToString()
          Test the method Exception.toString() on a set of sample objects.
 
Methods inherited from class junit.com.mcdermottroe.exemplar.NormalClassTestCase
addSample, samples, testAllConstructorsNonPrivate, testAllFieldsPrivateOrProtectedOrPublicStaticFinal, testCompareToConsistentWithEquals, testCompareToNullThrowsNPE, testCompareToSignsConsistent, testCompareToTransitive, testCopyable, testEqualsConsistent, testEqualsNullFalse, testEqualsNullPointerException, testEqualsReflexive, testEqualsSymmetric, testEqualsTransitive, testGetCopyProducesIdenticalObject, testHashCodeConsistentOverTime, testHashCodeConsistentWithEquals, testImplementsCopyable, testSerialization, testToStringConsistent
 
Methods inherited from class junit.com.mcdermottroe.exemplar.ExemplarTestCase
getTestedClass, testAllMethodsBeingTested, testCorrectPackage
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, 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, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExceptionClassTestCase

public ExceptionClassTestCase()
Method Detail

setUp

public void setUp()
           throws Exception
Set up the JUnit test.

Overrides:
setUp in class NormalClassTestCase<Exception>
Throws:
Exception - if TestCase.setUp() throws one.
See Also:
ExemplarTestCase.testedClass, TestCase.setUp()

testInheritsFromExemplarException

public void testInheritsFromExemplarException()
Test to ensure that Exception classes inherit from Throwable via the exemplar version of Exception rather than from the standard Exception.


testNoArgConstructor

public void testNoArgConstructor()
Test that a no-arg constructor is available and can be used to create an instance of the Exception class.

See Also:
Exception.Exception()

testOneStringConstructor

public void testOneStringConstructor()
Test that a constructor which takes a single argument of type String is available and can be used to create an instance of the Exception class.

See Also:
Exception.Exception(String)

testOneThrowableConstructor

public void testOneThrowableConstructor()
Test that a constructor which takes a single argument of type Throwable is available and can be used to create an instance of the Exception class.

See Also:
Exception.Exception(Throwable)

testStringThrowableConstructor

public void testStringThrowableConstructor()
Test that a constructor which takes two arguments, a String and a Throwable in that order, is available and can be used to create an instance of the Exception class.

See Also:
Exception.Exception(String, Throwable)

testGetBackTrace

public void testGetBackTrace()
Test the method Exception.getBackTrace() on a set of sample objects.


testToString

public void testToString()
Test the method Exception.toString() on a set of sample objects.


sampleFromNoArgConstructor

protected Exception sampleFromNoArgConstructor()
                                        throws IllegalAccessException,
                                               InstantiationException,
                                               InvocationTargetException,
                                               NoSuchMethodException
Create a sample object using the no-arg constructor.

Returns:
An Exception created using the no-arg constructor.
Throws:
IllegalAccessException - if the constructor is not accessible.
InstantiationException - if the constructor fails to be called.
InvocationTargetException - if the constructor throws an exception.
NoSuchMethodException - if the no-arg constructor does not exist.

sampleFromStringConstructor

protected Exception sampleFromStringConstructor()
                                         throws IllegalAccessException,
                                                InstantiationException,
                                                InvocationTargetException,
                                                NoSuchMethodException
Create a sample object using the String constructor.

Returns:
An Exception created using the String constructor.
Throws:
IllegalAccessException - if the constructor is not accessible.
InstantiationException - if the constructor fails to be called.
InvocationTargetException - if the constructor throws an exception.
NoSuchMethodException - if the no-arg constructor does not exist.

sampleFromThrowableConstructor

protected Exception sampleFromThrowableConstructor()
                                            throws IllegalAccessException,
                                                   InstantiationException,
                                                   InvocationTargetException,
                                                   NoSuchMethodException
Create a sample object using the Throwable constructor.

Returns:
An Exception created using the Throwable constructor.
Throws:
IllegalAccessException - if the constructor is not accessible.
InstantiationException - if the constructor fails to be called.
InvocationTargetException - if the constructor throws an exception.
NoSuchMethodException - if the no-arg constructor does not exist.

sampleFromStringThrowableConstructor

protected Exception sampleFromStringThrowableConstructor()
                                                  throws IllegalAccessException,
                                                         InstantiationException,
                                                         InvocationTargetException,
                                                         NoSuchMethodException
Create a sample object using the String, Throwable constructor.

Returns:
An Exception created using the String, Throwable constructor.
Throws:
IllegalAccessException - if the constructor is not accessible.
InstantiationException - if the constructor fails to be called.
InvocationTargetException - if the constructor throws an exception.
NoSuchMethodException - if the no-arg constructor does not exist.