Buggy code:
@ RunWith ( Arquillian . class ) @ RunAsClient public class EJBClientXidTransactionTestCase { private static final Logger logger = Logger . getLogger ( EJBClientXidTransactionTestCase . class ) ; private static final String APP_NAME = "ejb-remote-client-api-xidtx-test" ; private static final String MODULE_NAME = "ejb" ; private static TransactionManager txManager ; private static TransactionSynchronizationRegistry txSyncRegistry ; @ Deployment public static Archive < ? > createDeployment ( ) { } @ BeforeClass public static void beforeTestClass ( ) throws Exception { } @ Before public void beforeTest ( ) throws Exception { } private static void instantiateTxManagement ( ) { } @ Test public void testSLSBMandatoryTx ( ) throws Exception { } @ Test public void testClientTransactionManagement ( ) throws Exception { final StatelessEJBLocator < RemoteBatch > batchBeanLocator = new StatelessEJBLocator < RemoteBatch > ( RemoteBatch . class , EJBClientXidTransactionTestCase . APP_NAME , EJBClientXidTransactionTestCase . MODULE_NAME , BatchCreationBean . class . getSimpleName ( ) , "" ) ; final RemoteBatch batchBean = EJBClient . createProxy ( batchBeanLocator ) ; final StatelessEJBLocator < BatchRetriever > batchRetrieverLocator = new StatelessEJBLocator < BatchRetriever > ( BatchRetriever . class , EJBClientXidTransactionTestCase . APP_NAME , EJBClientXidTransactionTestCase . MODULE_NAME , BatchFetchingBean . class . getSimpleName ( ) , "" ) ; final BatchRetriever batchRetriever = EJBClient . createProxy ( batchRetrieverLocator ) ; final String batchName = "Simple<seq2seq4repair_space>Batch" ; EJBClientXidTransactionTestCase . txManager . begin ( ) ; try { batchBean . createBatch ( batchName ) ; } catch ( Exception e ) { EJBClientXidTransactionTestCase . txManager . rollback ( ) ; throw e ; } EJBClientXidTransactionTestCase . txManager . commit ( ) ; final Batch batchAfterCreation = batchRetriever . fetchBatch ( batchName ) ; Assert . assertNotNull ( "Batch<seq2seq4repair_space>was<seq2seq4repair_space>null<seq2seq4repair_space>after<seq2seq4repair_space>creation" , batchAfterCreation ) ; Assert . assertNull ( "Unexpected<seq2seq4repair_space>steps<seq2seq4repair_space>in<seq2seq4repair_space>batch,<seq2seq4repair_space>after<seq2seq4repair_space>creation" , batchAfterCreation . getStepNames ( ) ) ; final String step1 = "Simple<seq2seq4repair_space>step1" ; EJBClientXidTransactionTestCase . txManager . begin ( ) ; try { batchBean . step1 ( batchName , step1 ) ; } catch ( Exception e ) { EJBClientXidTransactionTestCase . txManager . rollback ( ) ; throw e ; } EJBClientXidTransactionTestCase . txManager . commit ( ) ; String successFullyCompletedSteps = step1 ; final Batch batchAfterStep1 = batchRetriever . fetchBatch ( batchName ) ; Assert . assertNotNull ( "Batch<seq2seq4repair_space>after<seq2seq4repair_space>step1<seq2seq4repair_space>was<seq2seq4repair_space>null" , batchAfterStep1 ) ; Assert . assertEquals ( "Unexpected<seq2seq4repair_space>steps<seq2seq4repair_space>in<seq2seq4repair_space>batch,<seq2seq4repair_space>after<seq2seq4repair_space>step1" , successFullyCompletedSteps , batchAfterStep1 . getStepNames ( ) ) ; final String appExceptionStep2 = "App<seq2seq4repair_space>exception<seq2seq4repair_space>Step<seq2seq4repair_space>2" ; EJBClientXidTransactionTestCase . txManager . begin ( ) ; try { batchBean . appExceptionFailingStep2 ( batchName , appExceptionStep2 ) ; <START_BUG> Assert . fail ( "Expected<seq2seq4repair_space>an<seq2seq4repair_space>application<seq2seq4repair_space>exception" ) ; <END_BUG> } catch ( SimpleAppException sae ) { EJBClientXidTransactionTestCase . txManager . rollback ( ) ; } final Batch batchAfterAppExceptionStep2 = batchRetriever . fetchBatch ( batchName ) ; Assert . assertNotNull ( "Batch<seq2seq4repair_space>after<seq2seq4repair_space>app<seq2seq4repair_space>exception<seq2seq4repair_space>step2<seq2seq4repair_space>was<seq2seq4repair_space>null" , batchAfterAppExceptionStep2 ) ; Assert . assertEquals ( "Unexpected<seq2seq4repair_space>steps<seq2seq4repair_space>in<seq2seq4repair_space>batch,<seq2seq4repair_space>after<seq2seq4repair_space>app<seq2seq4repair_space>exception<seq2seq4repair_space>step2" , successFullyCompletedSteps , batchAfterAppExceptionStep2 . getStepNames ( ) ) ; final String step2 = "Simple<seq2seq4repair_space>Step<seq2seq4repair_space>2" ; EJBClientXidTransactionTestCase . txManager . begin ( ) ; try { batchBean . successfulStep2 ( batchName , step2 ) ; } catch ( Exception e ) { EJBClientXidTransactionTestCase . txManager . rollback ( ) ; throw e ; } final Batch batchAfterStep2BeforeCommit = batchRetriever . fetchBatch ( batchName ) ; Assert . assertNotNull ( "Batch<seq2seq4repair_space>after<seq2seq4repair_space>step2,<seq2seq4repair_space>before<seq2seq4repair_space>commit<seq2seq4repair_space>was<seq2seq4repair_space>null" , batchAfterStep2BeforeCommit ) ; Assert . assertEquals ( "Unexpected<seq2seq4repair_space>steps<seq2seq4repair_space>in<seq2seq4repair_space>batch,<seq2seq4repair_space>after<seq2seq4repair_space>step2<seq2seq4repair_space>before<seq2seq4repair_space>commit" , successFullyCompletedSteps , batchAfterStep2BeforeCommit . getStepNames ( ) ) ; EJBClientXidTransactionTestCase . txManager . commit ( ) ; successFullyCompletedSteps = ( successFullyCompletedSteps + "," ) + step2 ; final Batch batchAfterStep2 = batchRetriever . fetchBatch ( batchName ) ; Assert . assertNotNull ( "Batch<seq2seq4repair_space>after<seq2seq4repair_space>step2<seq2seq4repair_space>was<seq2seq4repair_space>null" , batchAfterStep2 ) ; Assert . assertEquals ( "Unexpected<seq2seq4repair_space>steps<seq2seq4repair_space>in<seq2seq4repair_space>batch,<seq2seq4repair_space>after<seq2seq4repair_space>step2" , successFullyCompletedSteps , batchAfterStep2 . getStepNames ( ) ) ; final String step3 = "Simple<seq2seq4repair_space>Step<seq2seq4repair_space>3" ; EJBClientXidTransactionTestCase . txManager . begin ( ) ; batchBean . independentStep3 ( batchName , step3 ) ; EJBClientXidTransactionTestCase . txManager . rollback ( ) ; successFullyCompletedSteps = ( successFullyCompletedSteps + "," ) + step3 ; final Batch batchAfterStep3 = batchRetriever . fetchBatch ( batchName ) ; Assert . assertNotNull ( "Batch<seq2seq4repair_space>after<seq2seq4repair_space>step3<seq2seq4repair_space>was<seq2seq4repair_space>null" , batchAfterStep3 ) ; Assert . assertEquals ( "Unexpected<seq2seq4repair_space>steps<seq2seq4repair_space>in<seq2seq4repair_space>batch,<seq2seq4repair_space>after<seq2seq4repair_space>step3" , successFullyCompletedSteps , batchAfterStep3 . getStepNames ( ) ) ; final String step4 = "Simple<seq2seq4repair_space>Step<seq2seq4repair_space>4" ; EJBClientXidTransactionTestCase . txManager . begin ( ) ; batchBean . step4 ( batchName , step4 ) ; final String sysExceptionStep2 = "Sys<seq2seq4repair_space>exception<seq2seq4repair_space>step2" ; try { batchBean . systemExceptionFailingStep2 ( batchName , sysExceptionStep2 ) ; Assert . fail ( "Expected<seq2seq4repair_space>a<seq2seq4repair_space>system<seq2seq4repair_space>exception" ) ; } catch ( Exception e ) { EJBClientXidTransactionTestCase . txManager . rollback ( ) ; } final Batch batchAfterSysException = batchRetriever . fetchBatch ( batchName ) ; Assert . assertNotNull ( "Batch<seq2seq4repair_space>after<seq2seq4repair_space>system<seq2seq4repair_space>exception<seq2seq4repair_space>was<seq2seq4repair_space>null" , batchAfterSysException ) ; Assert . assertEquals ( "Unexpected<seq2seq4repair_space>steps<seq2seq4repair_space>in<seq2seq4repair_space>batch,<seq2seq4repair_space>after<seq2seq4repair_space>system<seq2seq4repair_space>exception" , successFullyCompletedSteps , batchAfterSysException . getStepNames ( ) ) ; } }

Fix:
Assert . fail ( "Expected<seq2seq4repair_space>a<seq2seq4repair_space>application<seq2seq4repair_space>exception" ) ;