Email Answering System
Version 1.0

test
Class ConnectionFactoryUnitTest

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--test.ConnectionFactoryUnitTest
All Implemented Interfaces:
junit.framework.Test

public class ConnectionFactoryUnitTest
extends junit.framework.TestCase

Unit test for the email resource adapter connection factory.

Author:
Derrick Oswald

Field Summary
protected  EmailConnectionFactory mConnectionFactory
          The connection factory used in the tests.
 
Constructor Summary
ConnectionFactoryUnitTest(String testName)
          Construct a ConnectionFactory test.
 
Method Summary
 Serializable deserialize(byte[] bytes)
          Deserialize an object.
static void main(String[] args)
          Mainline for the ConnectionFactory.
 byte[] serialize(Serializable object)
          Serialize an object.
protected  void setUp()
          Create a connection factory.
static junit.framework.Test suite()
          Create the suite of tests for the ConnectionFactory.
 void testGetConnection()
          Test no-arg get connection method.
 void testGetConnectionWithConnectionSpec()
          Test get connection using a connection spec.
 void testGetMetaData()
          Test get metadata method.
 void testRecordFactory()
          Test get record factory method.
 void testSerialization()
          Test the serializability of the factory.
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mConnectionFactory

protected EmailConnectionFactory mConnectionFactory
The connection factory used in the tests.

Constructor Detail

ConnectionFactoryUnitTest

public ConnectionFactoryUnitTest(String testName)
Construct a ConnectionFactory test.

Parameters:
testName - the name of the test
Method Detail

suite

public static junit.framework.Test suite()
Create the suite of tests for the ConnectionFactory.

Returns:
The suite of tests.

setUp

protected void setUp()
Create a connection factory.

Overrides:
setUp in class junit.framework.TestCase

testGetMetaData

public void testGetMetaData()
Test get metadata method.


testRecordFactory

public void testRecordFactory()
Test get record factory method.


testGetConnection

public void testGetConnection()
Test no-arg get connection method.


testGetConnectionWithConnectionSpec

public void testGetConnectionWithConnectionSpec()
Test get connection using a connection spec.


serialize

public byte[] serialize(Serializable object)
                 throws IOException
Serialize an object.

Parameters:
object - The object to be serialized.
Returns:
The bytes corresponding to the serialized object.
Throws:
IOException - If the serialization process has an error.

deserialize

public Serializable deserialize(byte[] bytes)
                         throws ClassNotFoundException,
                                IOException
Deserialize an object.

Parameters:
bytes - The bytes corresponding to the serialized object.
Returns:
The deserialized object.
Throws:
ClassNotFoundException - If the class of the serialized object cannot be found or loaded.
IOException - If the deserialization process has an error.

testSerialization

public void testSerialization()
Test the serializability of the factory.


main

public static void main(String[] args)
Mainline for the ConnectionFactory. Invoke the JUnit mainline.

Parameters:
args - JUnit arguments, optionally prefixed by a JUnit test runner class name. The default is junit.swingui.TestRunner, but other possibilities include:

junit.textui.TestRunner

junit.awtui.TestRunner


Email Answering System
Version 1.0

Copyright © 2003 Derrick Oswald. All rights reserved.