### Question:
Neo4jTransactionalContext implements TransactionalContext { @Override public void close( boolean success ) { if ( isOpen ) { try { statement.queryRegistration().unregisterExecutingQuery( executingQuery ); statement.close(); if ( success ) { transaction.success(); } else { transaction.failure(); } transaction.close(); } finally { statement = null; kernelTransaction = null; transaction = null; isOpen = false; } } } Neo4jTransactionalContext(
            GraphDatabaseQueryService graph,
            ThreadToStatementContextBridge txBridge,
            PropertyContainerLocker locker,
            InternalTransaction initialTransaction,
            Statement initialStatement,
            ExecutingQuery executingQuery,
            Kernel kernel
    ); @Override ExecutingQuery executingQuery(); @Override DbmsOperations dbmsOperations(); @Override KernelTransaction kernelTransaction(); @Override boolean isTopLevelTx(); @Override void close( boolean success ); @Override void terminate(); @Override void commitAndRestartTx(); @Override void cleanForReuse(); @Override TransactionalContext getOrBeginNewIfClosed(); @Override boolean isOpen(); @Override GraphDatabaseQueryService graph(); @Override Statement statement(); @Override void check(); @Override TxStateHolder stateView(); @Override Lock acquireWriteLock( PropertyContainer p ); @Override KernelTransaction.Revertable restrictCurrentTransaction( SecurityContext context ); @Override SecurityContext securityContext(); @Override ResourceTracker resourceTracker(); @Override StatisticProvider kernelStatisticProvider(); Neo4jTransactionalContext copyFrom( GraphDatabaseQueryService graph,
            ThreadToStatementContextBridge txBridge, PropertyContainerLocker locker,
            InternalTransaction initialTransaction,
            Statement initialStatement,
            ExecutingQuery executingQuery ); final KernelTransaction.Type transactionType; final SecurityContext securityContext; }### Answer:
@Test public void shouldNotBePossibleToCloseMultipleTimes() { InternalTransaction tx = mock( InternalTransaction.class ); Neo4jTransactionalContext context = newContext( tx ); context.close( false ); context.close( true ); context.close( false ); verify( tx ).failure(); verify( tx, never() ).success(); verify( tx ).close(); }