@Override
  public void handle(Connection connection, DatabaseCharsetChecker.State state) throws SQLException {
    // Charset is a global setting on Oracle, it can't be set on a specified schema with a
    // different value. To not block users who already have a SonarQube schema, charset
    // is verified only on fresh installs but not on upgrades. Let's hope they won't face
    // any errors related to charset if they didn't follow the UTF8 requirement when creating
    // the schema in previous SonarQube versions.
    if (state == DatabaseCharsetChecker.State.FRESH_INSTALL) {
      LoggerFactory.getLogger(getClass()).info("Verify that database charset is UTF8");
      expectUtf8(connection);
    }
  }
@Test
  public void fresh_install_fails_if_charset_is_not_utf8() throws Exception {
    answerCharset("LATIN");

    assertThatThrownBy(() -> underTest.handle(connection, DatabaseCharsetChecker.State.FRESH_INSTALL))
      .isInstanceOf(MessageException.class)
      .hasMessage("Oracle NLS_CHARACTERSET does not support UTF8: LATIN");
  }