net.sourceforge.sqlunit.test
Class ContextTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by net.sourceforge.sqlunit.test.ContextTest
All Implemented Interfaces:
junit.framework.Test

public class ContextTest
extends junit.framework.TestCase

Test to check generation of MockInitialContext by MockInitialContextFactory which gets a MockDataSource hard-bound into it, and which is then looked up using context.lookup(). The code in the test mimics the way a client would initialize a InitialContext from a JNDI name server, and retrieve a DataSource object by name. This is to mock tests for the JNDI way of getting a Connection for SQLUnit.

Version:
$Revision: 1.2 $
Author:
Sujit Pal (spal@users.sourceforge.net)

Constructor Summary
ContextTest(java.lang.String name)
          Boilerplate constructor.
 
Method Summary
static void main(java.lang.String[] argv)
          Boilerplate main method.
static junit.framework.Test suite()
          Boilerplate suite() method.
 void testMockJndiLookup()
          Test to see if we get a valid Connection using a mock JNDI lookup.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, name, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, 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
 

Constructor Detail

ContextTest

public ContextTest(java.lang.String name)
Boilerplate constructor.

Parameters:
name - the name of this test class.
Method Detail

main

public static void main(java.lang.String[] argv)
Boilerplate main method.

Parameters:
argv - the arguments (none).

suite

public static junit.framework.Test suite()
Boilerplate suite() method.

Returns:
a Test object.

testMockJndiLookup

public final void testMockJndiLookup()
                              throws java.lang.Exception
Test to see if we get a valid Connection using a mock JNDI lookup.

Throws:
java.lang.Exception - if the test failed.