com.thoughtworks.xjb.cmt
Class XjbTransactionHandlerTest

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.jmock.core.VerifyingTestCase
              extended byorg.jmock.core.MockObjectSupportTestCase
                  extended byorg.jmock.MockObjectTestCase
                      extended bycom.thoughtworks.xjb.cmt.TransactionMockingTestCase
                          extended bycom.thoughtworks.xjb.cmt.XjbTransactionHandlerTest
All Implemented Interfaces:
junit.framework.Test

public class XjbTransactionHandlerTest
extends TransactionMockingTestCase

Author:
Dan North

Field Summary
 
Fields inherited from class com.thoughtworks.xjb.cmt.TransactionMockingTestCase
commitUnlessRollbackOnly, createTransaction, factory, factoryMock, otherFactory, otherFactoryMock, otherTransactionMock, rollback, transactionMock
 
Fields inherited from class org.jmock.core.MockObjectSupportTestCase
ANYTHING, NOT_NULL, NULL
 
Constructor Summary
XjbTransactionHandlerTest()
           
 
Method Summary
 void testShouldCommitTransactionWhenRequiredMethodSucceeds()
           
 void testShouldCommitTransactionWhenRequiresNewMethodSucceeds()
           
 void testShouldCreateTransactionIfNoneExistsWhenRequiredMethodIsInvoked()
           
 void testShouldCreateTransactionWhenRequiresNewMethodIsInvoked()
           
 void testShouldFindExistingTransaction()
           
 void testShouldNotCommitTransactionWhenNeverMethodSucceeds()
           
 void testShouldNotCommitTransactionWhenRequiredMethodSucceedsIfThisHandlerDidNotCreateIt()
           
 void testShouldNotCommitWhenMandatoryMethodSucceeds()
           
 void testShouldNotCreateTransactionIfNoneExistsWhenNeverMethodIsInvoked()
           
 void testShouldNotCreateTransactionIfNoneExistsWhenNotSupportedMethodIsInvoked()
           
 void testShouldNotCreateTransactionIfNoneExistsWhenSupportsMethodIsInvoked()
           
 void testShouldNotCreateTransactionIfOneAlreadyExistsWhenSupportsMethodIsInvoked()
           
 void testShouldNotCreateTransactionIfOneExistsWhenMandatoryMethodIsInvoked()
           
 void testShouldNotRollbackTransactionWhenNeverMethodFails()
           
 void testShouldNotRollbackTransactionWhenRequiredMethodFailsIfThisHandlerDidNotCreateIt()
           
 void testShouldNotRollbackWhenMandatoryMethodFails()
           
 void testShouldRestoreSuspendedTransactionIfCommitThrowsExceptionWhenMethodSucceeds()
           
 void testShouldRestoreSuspendedTransactionIfRollbackThrowsExceptionWhenMethodFails()
           
 void testShouldRestoreTransactionIfOneExistedWhenNotSupportedMethodFails()
           
 void testShouldRestoreTransactionIfOneExistedWhenNotSupportedMethodSucceeds()
           
 void testShouldReuseExistingTransactionIfOneExistsWhenRequiredMethodIsInvoked()
           
 void testShouldRollbackTransactionWhenRequiredMethodFails()
           
 void testShouldRollbackTransactionWhenRequiresNewMethodFails()
           
 void testShouldStartWithNoTransaction()
           
 void testShouldSuspendExistingTransactionWhenRequiresNewMethodIsInvokedAndRestoreAfterItEnds()
           
 void testShouldSuspendExistingTransactionWhenRequiresNewMethodIsInvokedAndRestoreAfterItFails()
           
 void testShouldSuspendTransactionIfOneExistsWhenNotSupportedMethodIsInvoked()
           
 void testShouldThrowEJBExceptionIfNoTransactionExistsWhenMandatoryMethodIsInvoked()
           
 void testShouldThrowEJBExceptionIfTransactionExistsWhenNeverMethodIsInvoked()
           
 
Methods inherited from class com.thoughtworks.xjb.cmt.TransactionMockingTestCase
currentTransaction, factoryMockWillReturnTransactionMock, installMockTransactionAsCurrentTransaction, otherFactoryMockWillReturnOtherTransactionMock, setUp
 
Methods inherited from class org.jmock.MockObjectTestCase
atLeastOnce, defaultMockNameForType, mock, mock, never, newCoreMock, once, onConsecutiveCalls, onConsecutiveCalls, onConsecutiveCalls, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, throwException
 
Methods inherited from class org.jmock.core.MockObjectSupportTestCase
and, eq, eq, eq, eq, eq, eq, eq, eq, eq, eq, isA, newDummy, newDummy, newDummy, not, or, same, stringContains
 
Methods inherited from class org.jmock.core.VerifyingTestCase
registerToVerify, runBare, unregisterToVerify, verify
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, 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
 

Constructor Detail

XjbTransactionHandlerTest

public XjbTransactionHandlerTest()
Method Detail

testShouldStartWithNoTransaction

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

testShouldFindExistingTransaction

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

testShouldCreateTransactionIfNoneExistsWhenRequiredMethodIsInvoked

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

testShouldCommitTransactionWhenRequiredMethodSucceeds

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

testShouldReuseExistingTransactionIfOneExistsWhenRequiredMethodIsInvoked

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

testShouldNotCommitTransactionWhenRequiredMethodSucceedsIfThisHandlerDidNotCreateIt

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

testShouldRollbackTransactionWhenRequiredMethodFails

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

testShouldNotRollbackTransactionWhenRequiredMethodFailsIfThisHandlerDidNotCreateIt

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

testShouldCreateTransactionWhenRequiresNewMethodIsInvoked

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

testShouldCommitTransactionWhenRequiresNewMethodSucceeds

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

testShouldRollbackTransactionWhenRequiresNewMethodFails

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

testShouldSuspendExistingTransactionWhenRequiresNewMethodIsInvokedAndRestoreAfterItEnds

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

testShouldSuspendExistingTransactionWhenRequiresNewMethodIsInvokedAndRestoreAfterItFails

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

testShouldNotCreateTransactionIfNoneExistsWhenSupportsMethodIsInvoked

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

testShouldNotCreateTransactionIfOneAlreadyExistsWhenSupportsMethodIsInvoked

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

testShouldNotCreateTransactionIfNoneExistsWhenNotSupportedMethodIsInvoked

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

testShouldSuspendTransactionIfOneExistsWhenNotSupportedMethodIsInvoked

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

testShouldRestoreTransactionIfOneExistedWhenNotSupportedMethodSucceeds

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

testShouldRestoreTransactionIfOneExistedWhenNotSupportedMethodFails

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

testShouldThrowEJBExceptionIfNoTransactionExistsWhenMandatoryMethodIsInvoked

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

testShouldNotCreateTransactionIfOneExistsWhenMandatoryMethodIsInvoked

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

testShouldNotCommitWhenMandatoryMethodSucceeds

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

testShouldNotRollbackWhenMandatoryMethodFails

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

testShouldThrowEJBExceptionIfTransactionExistsWhenNeverMethodIsInvoked

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

testShouldNotCreateTransactionIfNoneExistsWhenNeverMethodIsInvoked

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

testShouldNotCommitTransactionWhenNeverMethodSucceeds

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

testShouldNotRollbackTransactionWhenNeverMethodFails

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

testShouldRestoreSuspendedTransactionIfCommitThrowsExceptionWhenMethodSucceeds

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

testShouldRestoreSuspendedTransactionIfRollbackThrowsExceptionWhenMethodFails

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