@VisibleForTesting
  static Properties extractCommonsHikariProperties(Properties properties) {
    Properties result = new Properties();
    for (Map.Entry<Object, Object> entry : properties.entrySet()) {
      String key = (String) entry.getKey();
      if (!ALLOWED_SONAR_PROPERTIES.contains(key)) {
        if (DEPRECATED_SONAR_PROPERTIES.contains(key)) {
          LOG.warn("Property [{}] has no effect as pool connection implementation changed, check 9.7 upgrade notes.", key);
        }
        continue;
      }
      if (StringUtils.startsWith(key, SONAR_JDBC)) {
        String resolvedKey = toHikariPropertyKey(key);
        String existingValue = (String) result.setProperty(resolvedKey, (String) entry.getValue());
        checkState(existingValue == null || existingValue.equals(entry.getValue()),
          "Duplicate property declaration for resolved jdbc key '%s': conflicting values are '%s' and '%s'", resolvedKey, existingValue, entry.getValue());
        result.setProperty(resolvedKey, (String) entry.getValue());
      }
    }
    return result;
  }
@Test
  public void shouldExtractHikariProperties() {
    Properties props = new Properties();
    props.setProperty("sonar.jdbc.driverClassName", "my.Driver");
    props.setProperty("sonar.jdbc.username", "me");
    props.setProperty("sonar.jdbc.dataSource.password", "my_password");
    props.setProperty("sonar.jdbc.dataSource.portNumber", "9999");
    props.setProperty("sonar.jdbc.connectionTimeout", "8000");
    props.setProperty("sonar.jdbc.maximumPoolSize", "80");
    props.setProperty("sonar.jdbc.minimumIdle", "10");
    props.setProperty("sonar.jdbc.schema", "db-schema");
    props.setProperty("sonar.jdbc.validationTimeout", "5000");
    props.setProperty("sonar.jdbc.catalog", "db-catalog");
    props.setProperty("sonar.jdbc.initializationFailTimeout", "5000");
    props.setProperty("sonar.jdbc.maxLifetime", "1800000");
    props.setProperty("sonar.jdbc.leakDetectionThreshold", "0");
    props.setProperty("sonar.jdbc.keepaliveTime", "30000");
    props.setProperty("sonar.jdbc.idleTimeout", "600000");

    Properties hikariProps = DefaultDatabase.extractCommonsHikariProperties(props);

    assertThat(hikariProps).hasSize(15);
    assertThat(hikariProps.getProperty("driverClassName")).isEqualTo("my.Driver");
    assertThat(hikariProps.getProperty("dataSource.user")).isEqualTo("me");
    assertThat(hikariProps.getProperty("dataSource.password")).isEqualTo("my_password");
    assertThat(hikariProps.getProperty("dataSource.portNumber")).isEqualTo("9999");
    assertThat(hikariProps.getProperty("connectionTimeout")).isEqualTo("8000");
    assertThat(hikariProps.getProperty("maximumPoolSize")).isEqualTo("80");
    assertThat(hikariProps.getProperty("minimumIdle")).isEqualTo("10");
    assertThat(hikariProps.getProperty("schema")).isEqualTo("db-schema");
    assertThat(hikariProps.getProperty("validationTimeout")).isEqualTo("5000");
    assertThat(hikariProps.getProperty("catalog")).isEqualTo("db-catalog");
    assertThat(hikariProps.getProperty("initializationFailTimeout")).isEqualTo("5000");
    assertThat(hikariProps.getProperty("maxLifetime")).isEqualTo("1800000");
    assertThat(hikariProps.getProperty("leakDetectionThreshold")).isEqualTo("0");
    assertThat(hikariProps.getProperty("keepaliveTime")).isEqualTo("30000");
    assertThat(hikariProps.getProperty("idleTimeout")).isEqualTo("600000");

  }