### Question:
BoltStateMachineV1 implements BoltStateMachine { @Override public void handleExternalFailure( Neo4jError error, BoltResponseHandler handler ) throws BoltConnectionFatality { before( handler ); try { if ( connectionState.canProcessMessage() ) { fail( error ); state = failedState; } } finally { after(); } } BoltStateMachineV1( BoltStateMachineSPI spi, BoltChannel boltChannel, Clock clock ); @Override void process( RequestMessage message, BoltResponseHandler handler ); @Override void markFailed( Neo4jError error ); @Override void interrupt(); @Override void validateTransaction(); @Override void handleExternalFailure( Neo4jError error, BoltResponseHandler handler ); @Override boolean isClosed(); @Override void close(); @Override String id(); @Override void markForTermination(); @Override boolean shouldStickOnThread(); @Override boolean hasOpenStatement(); @Override boolean reset(); @Override void handleFailure( Throwable cause, boolean fatal ); BoltStateMachineState state(); StatementProcessor statementProcessor(); MutableConnectionState connectionState();  }### Answer:
@Test public void shouldInvokeResponseHandlerOnNextExternalErrorMessageOnMarkFailedIfNoHandler() throws Exception { testMarkFailedOnNextMessage( ( machine, handler ) -> machine.handleExternalFailure( Neo4jError.from( Status.Request.Invalid, "invalid" ), handler ) ); }
@Test public void shouldInvokeResponseHandlerOnNextExternalErrorMessageOnMarkFailedIfAlreadyFailedAndNoHandler() throws Exception { testMarkFailedShouldYieldIgnoredIfAlreadyFailed( ( machine, handler ) -> machine.handleExternalFailure( Neo4jError.from( Status.Request.Invalid, "invalid" ), handler ) ); }