public static String getDatabaseName(final SQLStatement sqlStatement, final String currentDatabaseName) {
        Optional<DatabaseSegment> databaseSegment = sqlStatement instanceof FromDatabaseAvailable ? ((FromDatabaseAvailable) sqlStatement).getDatabase() : Optional.empty();
        return databaseSegment.map(optional -> optional.getIdentifier().getValue()).orElse(currentDatabaseName);
    }
@Test
    void assertDatabaseNameWhenNotAvailableInSQLStatement() {
        assertThat(DatabaseNameUtils.getDatabaseName(mock(SQLStatement.class), "foo_db"), is("foo_db"));
    }