org.mockejb.jndi
Class MockContextTest

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.mockejb.jndi.MockContextTest
All Implemented Interfaces:
junit.framework.Test

public class MockContextTest
extends junit.framework.TestCase

Tests all basic methods of MockContext. Test for remote context lookup is not included.

Author:
Dimitar Gospodinov

Constructor Summary
MockContextTest(java.lang.String name)
           
 
Method Summary
protected  void setUp()
           
protected  void tearDown()
           
 void testBindLookup()
          Tests ability to bind name to object and inability to bind duplicate names.
 void testCompositeNameWithLeadingTrailingEmptyComponents()
           
 void testDelegateContext()
          Tests that delegate context is invoked when MockContext does not find the name
 void testGetCompositeName()
          Tests "getCompositeName" method
 void testListBindings()
          Tests ability to list bindings for a context - specified by name through object reference.
 void testLookup()
           
 void testSubcontextCreationOfDuplicates()
          Tests inability to create duplicate subcontexts.
 void testSubcontextDestruction()
          Tests ability to destroy empty subcontexts.
 void testSubcontextInvokingMethodsOnDestroyedContext()
          Tests inability to invoke methods on destroyed subcontexts.
 void testSubcontextNonEmptyDestruction()
          Tests inability to destroy non empty subcontexts.
 void testTwoSeparatorNames()
          Tests substitution of '.' with '/' when parsing string names.
 void testUnbind()
          Tests ability to unbind names.
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MockContextTest

public MockContextTest(java.lang.String name)
Method Detail

setUp

protected void setUp()
              throws java.lang.Exception
Throws:
java.lang.Exception

tearDown

protected void tearDown()
                 throws java.lang.Exception
Throws:
java.lang.Exception

testSubcontextCreationOfDuplicates

public void testSubcontextCreationOfDuplicates()
                                        throws javax.naming.NamingException
Tests inability to create duplicate subcontexts.

Throws:
javax.naming.NamingException

testSubcontextNonEmptyDestruction

public void testSubcontextNonEmptyDestruction()
                                       throws javax.naming.NamingException
Tests inability to destroy non empty subcontexts.

Throws:
javax.naming.NamingException

testSubcontextDestruction

public void testSubcontextDestruction()
                               throws javax.naming.NamingException
Tests ability to destroy empty subcontexts.

Throws:
javax.naming.NamingException

testSubcontextInvokingMethodsOnDestroyedContext

public void testSubcontextInvokingMethodsOnDestroyedContext()
                                                     throws javax.naming.NamingException
Tests inability to invoke methods on destroyed subcontexts.

Throws:
javax.naming.NamingException

testBindLookup

public void testBindLookup()
                    throws javax.naming.NamingException
Tests ability to bind name to object and inability to bind duplicate names. TODO Duplicate names can not be tested at this time because we treat bind as re-bind.

Throws:
javax.naming.NamingException

testUnbind

public void testUnbind()
                throws javax.naming.NamingException
Tests ability to unbind names.

Throws:
javax.naming.NamingException

testListBindings

public void testListBindings()
                      throws javax.naming.NamingException
Tests ability to list bindings for a context - specified by name through object reference.

Throws:
javax.naming.NamingException

testCompositeNameWithLeadingTrailingEmptyComponents

public void testCompositeNameWithLeadingTrailingEmptyComponents()
                                                         throws java.lang.Exception
Throws:
java.lang.Exception

testLookup

public void testLookup()
                throws java.lang.Exception
Throws:
java.lang.Exception

testGetCompositeName

public void testGetCompositeName()
                          throws java.lang.Exception
Tests "getCompositeName" method

Throws:
java.lang.Exception

testDelegateContext

public void testDelegateContext()
                         throws java.lang.Exception
Tests that delegate context is invoked when MockContext does not find the name

Throws:
java.lang.Exception

testTwoSeparatorNames

public void testTwoSeparatorNames()
                           throws javax.naming.NamingException
Tests substitution of '.' with '/' when parsing string names.

Throws:
javax.naming.NamingException