ConfigUtil { public static @Nullable Object getDefaultValueAsCorrectType(ConfigDescriptionParameter parameter) { return getDefaultValueAsCorrectType(parameter.getName(), parameter.getType(), parameter.getDefault()); }  static @Nullable Object getDefaultValueAsCorrectType(ConfigDescriptionParameter parameter); static void applyDefaultConfiguration(Configuration configuration,
            @Nullable ConfigDescription configDescription); static Map<String, @Nullable Object> normalizeTypes(Map<String, @Nullable Object> configuration); static Object normalizeType(Object value, @Nullable ConfigDescriptionParameter configDescriptionParameter); static @Nullable Map<String, Object> normalizeTypes(@Nullable Map<String, Object> configuration,
            List<ConfigDescription> configDescriptions); static Object normalizeType(Object value);  }
@Test public void verifyNormalizeDefaultTypeForTextReturnsString() { assertThat(ConfigUtil.getDefaultValueAsCorrectType( ConfigDescriptionParameterBuilder.create("test", TEXT).withDefault("foo").build()), is("foo")); assertThat(ConfigUtil.getDefaultValueAsCorrectType( ConfigDescriptionParameterBuilder.create("test", TEXT).withDefault("1.0").build()), is("1.0")); }
@Test public void verifyNormalizeDefaultTypeForBooleanReturnsBoolean() { assertThat( ConfigUtil.getDefaultValueAsCorrectType( ConfigDescriptionParameterBuilder.create("test", BOOLEAN).withDefault("true").build()), is(Boolean.TRUE)); assertThat( ConfigUtil.getDefaultValueAsCorrectType( ConfigDescriptionParameterBuilder.create("test", BOOLEAN).withDefault("YES").build()), is(Boolean.FALSE)); }
@Test public void verifyNormalizeDefaultTypeForIntegerReturnsIntegerOrNull() { assertThat( ConfigUtil.getDefaultValueAsCorrectType( ConfigDescriptionParameterBuilder.create("test", INTEGER).withDefault("1").build()), is(BigDecimal.ONE)); assertThat( ConfigUtil.getDefaultValueAsCorrectType( ConfigDescriptionParameterBuilder.create("test", INTEGER).withDefault("1.2").build()), is(BigDecimal.ONE)); assertThat( ConfigUtil.getDefaultValueAsCorrectType( ConfigDescriptionParameterBuilder.create("test", INTEGER).withDefault("foo").build()), is(nullValue())); }
@Test public void verifyNormalizeDefaultTypeForDecimalReturnsimalBigDecOrNull() { assertThat( ConfigUtil.getDefaultValueAsCorrectType( ConfigDescriptionParameterBuilder.create("test", DECIMAL).withDefault("1").build()), is(BigDecimal.ONE)); assertThat( ConfigUtil.getDefaultValueAsCorrectType( ConfigDescriptionParameterBuilder.create("test", DECIMAL).withDefault("1.2").build()), is(new BigDecimal("1.2"))); assertThat( ConfigUtil.getDefaultValueAsCorrectType( ConfigDescriptionParameterBuilder.create("test", DECIMAL).withDefault("foo").build()), is(nullValue())); }