### Question:
ErrorReporter { public void report( Neo4jError error ) { if ( error.status().code().classification() == DatabaseError ) { String message = format( "Client triggered an unexpected error [%s]: %s, reference %s.", error.status().code().serialize(), error.message(), error.reference() ); userLog.error( message ); if ( error.cause() != null ) { debugLog.error( message, error.cause() ); } } } ErrorReporter( LogService logging );   ErrorReporter( Log userLog, Log debugLog ); void report( Neo4jError error );  }### Answer:
@Test public void onlyDatabaseErrorsAreLogged() { AssertableLogProvider userLog = new AssertableLogProvider(); AssertableLogProvider internalLog = new AssertableLogProvider(); ErrorReporter reporter = newErrorReporter( userLog, internalLog ); for ( Status.Classification classification : Status.Classification.values() ) { if ( classification != Status.Classification.DatabaseError ) { Status.Code code = newStatusCode( classification ); Neo4jError error = Neo4jError.from( () -> code, "Database error" ); reporter.report( error ); userLog.assertNoLoggingOccurred(); internalLog.assertNoLoggingOccurred(); } } }
@Test public void databaseErrorShouldLogFullMessageInDebugLogAndHelpfulPointerInUserLog() { AssertableLogProvider userLog = new AssertableLogProvider(); AssertableLogProvider internalLog = new AssertableLogProvider(); ErrorReporter reporter = newErrorReporter( userLog, internalLog ); Neo4jError error = Neo4jError.fatalFrom( new TestDatabaseError() ); UUID reference = error.reference(); reporter.report( error ); userLog.rawMessageMatcher().assertContains( "Client triggered an unexpected error" ); userLog.rawMessageMatcher().assertContains( reference.toString() ); userLog.rawMessageMatcher().assertContains( "Database error" ); internalLog.rawMessageMatcher().assertContains( reference.toString() ); internalLog.rawMessageMatcher().assertContains( "Database error" ); }