@Test
  public void testToProperties() throws IOException {
    com.mastfrog.settings.Settings config =
        new SettingsBuilder()
            .addDefaultsFromClasspath()
            .addGeneratedDefaultsFromClasspath()
            .add("com/mastfrog/configuration/others.properties")
            .add("com/mastfrog/configuration/more.properties")
            .add("com/mastfrog/configuration/andmore.properties")
            .build();

    Properties p = config.toProperties();
    assertEquals(
        new HashSet<>(
            Arrays.asList("age", "auto", "bang", "whee", "foo", "abc", "liesel", "monkey")),
        new HashSet<>(p.stringPropertyNames()));
    assertEquals("fiz", p.getProperty("foo"));
  }
  @Test
  public void testLoad() throws IOException {
    com.mastfrog.settings.Settings config =
        new SettingsBuilder()
            .add("com/mastfrog/configuration/others.properties")
            .add("com/mastfrog/configuration/more.properties")
            .build();
    for (String s : config) {
      System.out.println(s + "=" + config.getString(s));
    }
    assertTrue(config.allKeys().contains("whee"));
    assertEquals("oobiedoobie", config.getString("whee"));
    assertTrue(config.allKeys().contains("foo"));
    assertEquals("fiz", config.getString("foo"));

    config =
        new SettingsBuilder()
            .add("com/mastfrog/configuration/others.properties")
            .add("com/mastfrog/configuration/more.properties")
            .add("com/mastfrog/configuration/andmore.properties")
            .build();
    assertTrue(config.allKeys().contains("abc"));
    assertEquals("def", config.getString("abc"));
  }
  @Override
  public BoneCPConfig get() {
    BoneCPConfig config = new BoneCPConfig();
    config.setJdbcUrl(settings.getString(JDBC_URL, DEFAULT_JDBC_URL));
    config.setPartitionCount(settings.getInt(PARTITION_COUNT, DEFAULT_PARTITION_COUNT));
    config.setMinConnectionsPerPartition(
        settings.getInt(MIN_CONNECTIONS_PER_PARTITION, DEFAULT_MIN_CONNECTIONS_PER_PARTITION));
    config.setMaxConnectionsPerPartition(
        settings.getInt(MAX_CONNECTIONS_PER_PARTITION, DEFAULT_MAX_CONNECTIONS_PER_PARTITION));
    config.setCloseOpenStatements(
        settings.getBoolean(CLOSE_OPEN_STATEMENTS, DEFAULT_CLOSE_OPEN_STATEMENTS));
    config.setCloseConnectionWatch(
        settings.getBoolean(CLOSE_CONNECTION_WATCH, DEFAULT_CLOSE_CONNECTION_WATCH));

    config.setDefaultReadOnly(settings.getBoolean(READ_ONLY, DEFAULT_READ_ONLY));
    config.setAcquireRetryAttempts(
        settings.getInt(ACQUIRE_RETRY_ATTEMPTS, DEFAULT_ACQUIRE_RETRY_ATTEMPTS));
    Long timeout = settings.getLong(CONNECTION_TIMEOUT_MINUTES);
    if (timeout != null) {
      config.setConnectionTimeout(timeout, TimeUnit.MINUTES);
    }
    Long maxConnectionAgeInMinutes = settings.getLong(MAX_CONNECTION_AGE_MINUTES);
    if (maxConnectionAgeInMinutes != null) {
      config.setMaxConnectionAgeInSeconds(maxConnectionAgeInMinutes * 60);
    }
    Long idleMaxAge = settings.getLong(IDLE_MAX_AGE_SECONDS);
    if (idleMaxAge != null) {
      config.setIdleMaxAgeInSeconds(idleMaxAge);
    }
    String u = settings.getString(JDBC_USER, DEFAULT_JDBC_USER);
    String p = settings.getString(JDBC_PASSWORD);
    if (u != null && !u.trim().isEmpty()) {
      config.setUsername(u);
    }
    if (p != null && !p.trim().isEmpty()) {
      config.setPassword(p);
    }
    return postConfig.onConfigure(config);
  }