use of com.synopsys.integration.configuration.config.PropertyConfiguration in project synopsys-detect by blackducksoftware.
the class EnumPropertiesTests method testDeprecatedValueDefaultProvided.
@Test
public void testDeprecatedValueDefaultProvided() throws InvalidPropertyException {
EnumProperty<Example> property = new EnumProperty<>("enum.valued", Example.THIRD, Example.class);
property.deprecateValue(Example.THIRD, "Third is deprecated");
PropertyConfiguration config = configOf(Pair.of("enum.valued", "THIRD"));
Optional<Example> value = config.getProvidedParsedValue(property);
Assertions.assertTrue(value.isPresent());
List<DeprecatedValueUsage> deprecatedUsages = property.checkForDeprecatedValues(value.get());
Assertions.assertEquals(deprecatedUsages.size(), 1);
Assertions.assertEquals(deprecatedUsages.get(0).getValue(), "THIRD");
Assertions.assertEquals(deprecatedUsages.get(0).getInfo().getValueDescription(), "THIRD");
Assertions.assertEquals(deprecatedUsages.get(0).getInfo().getReason(), "Third is deprecated");
}
use of com.synopsys.integration.configuration.config.PropertyConfiguration in project synopsys-detect by blackducksoftware.
the class EnumPropertiesTests method testNullable.
@Test
public void testNullable() throws InvalidPropertyException {
NullableEnumProperty<Example> property = new NullableEnumProperty<>("enum.nullable", Example.class);
PropertyConfiguration config = configOf(Pair.of("enum.nullable", "ANOTHER"));
Assertions.assertEquals(Optional.of(Example.ANOTHER), config.getValue(property));
PropertyTestHelpUtil.assertAllHelpValid(property, Bds.listOf("THING", "ANOTHER", "THIRD"));
}
use of com.synopsys.integration.configuration.config.PropertyConfiguration in project synopsys-detect by blackducksoftware.
the class SoftEnumPropertiesTest method testValuedActualValue.
@Test
public void testValuedActualValue() throws InvalidPropertyException {
SoftEnumProperty<Example> property = new SoftEnumProperty<>("enum.valued", SoftEnumValue.ofEnumValue(Example.ANOTHER), Example.class);
PropertyConfiguration config = configOf(Pair.of("enum.valued", "THIRD"));
Assertions.assertEquals(SoftEnumValue.ofEnumValue(Example.THIRD), config.getValue(property));
PropertyTestHelpUtil.assertAllHelpValid(property, Arrays.asList("THING", "ANOTHER", "THIRD"));
}
use of com.synopsys.integration.configuration.config.PropertyConfiguration in project synopsys-detect by blackducksoftware.
the class SoftEnumPropertiesTest method testList.
@Test
public void testList() throws InvalidPropertyException {
SoftEnumListProperty<Example> property = new SoftEnumListProperty<>("enum.list", Collections.singletonList(SoftEnumValue.ofEnumValue(Example.THIRD)), Example.class);
PropertyConfiguration config = configOf(Pair.of("enum.list", "ANOTHER,THING,test"));
Assertions.assertEquals(Arrays.asList(SoftEnumValue.ofEnumValue(Example.ANOTHER), SoftEnumValue.ofEnumValue(Example.THING), SoftEnumValue.ofSoftValue("test")), config.getValue(property));
PropertyTestHelpUtil.assertAllListHelpValid(property);
}
use of com.synopsys.integration.configuration.config.PropertyConfiguration in project synopsys-detect by blackducksoftware.
the class SoftEnumPropertiesTest method testNullableActualValue.
@Test
public void testNullableActualValue() throws InvalidPropertyException {
NullableSoftEnumProperty<Example> property = new NullableSoftEnumProperty<>("enum.nullable", Example.class);
PropertyConfiguration config = configOf(Pair.of("enum.nullable", "ANOTHER"));
Assertions.assertEquals(Optional.of(SoftEnumValue.ofEnumValue(Example.ANOTHER)), config.getValue(property));
PropertyTestHelpUtil.assertAllHelpValid(property, Arrays.asList("THING", "ANOTHER", "THIRD"));
}
Aggregations