ErrorUtil { public static ServiceUnavailableException newConnectionTerminatedError( String reason ) { if ( reason == null ) { return newConnectionTerminatedError(); } return new ServiceUnavailableException( "Connection to the database terminated. " + reason ); } private  ErrorUtil(); static ServiceUnavailableException newConnectionTerminatedError( String reason ); static ServiceUnavailableException newConnectionTerminatedError(); static ResultConsumedException newResultConsumedError(); static Neo4jException newNeo4jError( String code, String message ); static boolean isFatal( Throwable error ); static void rethrowAsyncException( ExecutionException e ); static void addSuppressed( Throwable mainError, Throwable error ); static Throwable getRootCause( Throwable error );  }
@Test void shouldCreateConnectionTerminatedError() { ServiceUnavailableException error = newConnectionTerminatedError(); assertThat( error.getMessage(), startsWith( "Connection to the database terminated" ) ); }
@Test void shouldCreateConnectionTerminatedErrorWithNullReason() { ServiceUnavailableException error = newConnectionTerminatedError( null ); assertThat( error.getMessage(), startsWith( "Connection to the database terminated" ) ); }
@Test void shouldCreateConnectionTerminatedErrorWithReason() { String reason = "Thread interrupted"; ServiceUnavailableException error = newConnectionTerminatedError( reason ); assertThat( error.getMessage(), startsWith( "Connection to the database terminated" ) ); assertThat( error.getMessage(), containsString( reason ) ); }