### Question:
TransactionStateMachine implements StatementProcessor { @Override public void markCurrentTransactionForTermination() { KernelTransaction tx = ctx.currentTransaction; if ( tx != null ) { tx.markForTermination( Status.Transaction.Terminated ); } } TransactionStateMachine( TransactionStateMachineSPI spi, AuthenticationResult authenticationResult, Clock clock ); State state(); @Override void beginTransaction( Bookmark bookmark ); @Override void beginTransaction( Bookmark bookmark, Duration txTimeout, Map<String,Object> txMetadata ); @Override StatementMetadata run( String statement, MapValue params ); @Override StatementMetadata run( String statement, MapValue params, Bookmark bookmark, Duration txTimeout, Map<String,Object> txMetaData ); @Override Bookmark streamResult( ThrowingConsumer<BoltResult, Exception> resultConsumer ); @Override Bookmark commitTransaction(); @Override void rollbackTransaction(); @Override boolean hasOpenStatement(); @Override void reset(); @Override void markCurrentTransactionForTermination(); @Override void validateTransaction(); @Override boolean hasTransaction();  }### Answer:
@Test public void shouldNotMarkForTerminationWhenNoTransaction() throws Exception { KernelTransaction transaction = newTransaction(); TransactionStateMachineV1SPI stateMachineSPI = newTransactionStateMachineSPI( transaction ); TransactionStateMachine stateMachine = newTransactionStateMachine( stateMachineSPI ); stateMachine.markCurrentTransactionForTermination(); verify( transaction, never() ).markForTermination( any() ); }