Java 类org.apache.commons.configuration2.builder.fluent.FileBasedBuilderParameters 实例源码

项目:commons-configuration2-jackson    文件:JsonConfigurationTests.java   
@Test
public void readFromBuilder() throws ConfigurationException {
    // Arrange
    final FileBasedBuilderParameters params = new Parameters()
            .fileBased()
            .setThrowExceptionOnMissing(true)
            .setEncoding("UTF-8")
            .setFileName(Resources.getResource("example.json").toString());

    // Act
    final FileBasedConfigurationBuilder<JsonConfiguration> builder = new FileBasedConfigurationBuilder<>(
            JsonConfiguration.class);
    final JsonConfiguration sut = builder.configure(params).getConfiguration();

    // Assert
    assertThat(sut.getString("name"), is("testName"));
}