SOAj Consolidated


info.soaj.core.unittest
Class SjBaseOutsideContainerTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by info.soaj.core.unittest.SjBaseOutsideContainerTestCase
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
SjCustomDescriptorDocumentExampleTest, SjDefaultDescriptorDocumentExampleTest, SjNoDescriptorDocumentExampleTest, SjPluginTextEmailExampleTest

public abstract class SjBaseOutsideContainerTestCase
extends junit.framework.TestCase

Base test case.

Copyright (c) 2006 - 2009 by Global Technology Consulting Group, Inc. at gtcGroup.com .

Since:
v. 1.0
Author:
MarvinToll@gtcGroup.com

Field Summary
protected  java.lang.String descriptorDocumentStatus
          Introduces state to test case.
protected static java.lang.String NO_DESCRIPTOR_DOCUMENT_REQUIRED
          Used to indicate no descriptor document should be loaded.
protected  long startTime
          Start time.
protected static java.lang.String USE_DEFAULT_DESCRIPTOR_DOCUMENT
          Used to indicate the default descriptor document should be loaded.
 
Constructor Summary
SjBaseOutsideContainerTestCase()
          Constructor
SjBaseOutsideContainerTestCase(java.lang.String name)
          Constructor
 
Method Summary
protected static boolean assertException(java.lang.Class<?> expectedExceptionClass, java.lang.Exception exception)
          Assert that a specified throwable was thrown.
protected static boolean assertExceptionContext(java.lang.Class<?> expectedClassContext, java.lang.String expectedMethodContext, SjInterfaceThrowable actualException)
          Assert that a throwable was thrown from the expected class and method.
protected static
<T extends java.lang.Throwable>
void
fail(java.lang.Class<T> throwable)
          Fails a test expecting an exception.
private  void init()
          This method initializes cache.
protected abstract  java.lang.String initCB()
           This callback method is invoked upon construction and establishes the descriptor document used for each unit test method following the clearing of plugin cache.
protected  void setUp()
          This callback method sets up the test fixture for each unit test method.
protected  void tearDown()
          This callback method tears down the test fixture for each unit test method.
 
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
 

Field Detail

USE_DEFAULT_DESCRIPTOR_DOCUMENT

protected static final java.lang.String USE_DEFAULT_DESCRIPTOR_DOCUMENT
Used to indicate the default descriptor document should be loaded.


NO_DESCRIPTOR_DOCUMENT_REQUIRED

protected static final java.lang.String NO_DESCRIPTOR_DOCUMENT_REQUIRED
Used to indicate no descriptor document should be loaded.

See Also:
Constant Field Values

descriptorDocumentStatus

protected java.lang.String descriptorDocumentStatus
Introduces state to test case.


startTime

protected long startTime
Start time.

Constructor Detail

SjBaseOutsideContainerTestCase

public SjBaseOutsideContainerTestCase()
Constructor


SjBaseOutsideContainerTestCase

public SjBaseOutsideContainerTestCase(java.lang.String name)
Constructor

Parameters:
name -
Method Detail

init

private void init()
This method initializes cache.


initCB

protected abstract java.lang.String initCB()

This callback method is invoked upon construction and establishes the descriptor document used for each unit test method following the clearing of plugin cache.

Many unit tests do not have plugin activation dependencies and therefore do not require descriptor document parsing. In that case, return:

 ----> NO_DESCRIPTOR_DOCUMENT_REQUIRED
 
If the default descriptor document is required then return:
 ----> USE_DEFAULT_DESCRIPTOR_DOCUMENT
 
If a custom descriptor document (on the classpath) is needed then return a String similar to:
 ----> "soaj-myplugin-example-properties-test.xml"
 

Returns:
String - The name of the descriptor document (on the classpath) or USE_DEFAULT_DESCRIPTOR_DOCUMENT or NO_DESCRIPTOR_DOCUMENT_REQUIRED.

setUp

protected void setUp()
              throws java.lang.Exception
This callback method sets up the test fixture for each unit test method. It establishes a timestamp, clears cache and loads the descriptor document indicated at construction by the initCB method.

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

tearDown

protected void tearDown()
                 throws java.lang.Exception
This callback method tears down the test fixture for each unit test method.

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

fail

protected static <T extends java.lang.Throwable> void fail(java.lang.Class<T> throwable)
Fails a test expecting an exception.

Type Parameters:
T -
Parameters:
throwable -

assertExceptionContext

protected static boolean assertExceptionContext(java.lang.Class<?> expectedClassContext,
                                                java.lang.String expectedMethodContext,
                                                SjInterfaceThrowable actualException)
Assert that a throwable was thrown from the expected class and method.

Parameters:
expectedClassContext -
expectedMethodContext -
actualException -
Returns:
boolean

assertException

protected static boolean assertException(java.lang.Class<?> expectedExceptionClass,
                                         java.lang.Exception exception)
Assert that a specified throwable was thrown.

Parameters:
expectedExceptionClass -
exception -
Returns:
boolean

SOAj Consolidated


Copyright (c) 2006 - 2009 by Global Technology Consulting Group, Inc. at gtcGroup.com.
Use is authorized, provided the source is acknowledged by inclusion of this copyright notice.