### Question:
Neo4jTransactionalContext implements TransactionalContext { @Override public boolean isTopLevelTx() { return transaction.transactionType() == KernelTransaction.Type.implicit; } 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 shouldBeTopLevelWithImplicitTx() { InternalTransaction tx = mock( InternalTransaction.class ); when( tx.transactionType() ).thenReturn( KernelTransaction.Type.implicit ); Neo4jTransactionalContext context = newContext( tx ); assertTrue( context.isTopLevelTx() ); }
@Test public void shouldNotBeTopLevelWithExplicitTx() { InternalTransaction tx = mock( InternalTransaction.class ); when( tx.transactionType() ).thenReturn( KernelTransaction.Type.explicit ); Neo4jTransactionalContext context = newContext( tx ); assertFalse( context.isTopLevelTx() ); }