use of com.synopsys.integration.configuration.config.PropertyConfiguration in project synopsys-detect by blackducksoftware.
the class EnumPropertiesTests method testDeprecatedValue.
@Test
public void testDeprecatedValue() throws InvalidPropertyException {
EnumProperty<Example> property = new EnumProperty<>("enum.valued", Example.ANOTHER, 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 SoftEnumPropertiesTest method testValuedStringValue.
@Test
public void testValuedStringValue() throws InvalidPropertyException {
SoftEnumProperty<Example> property = new SoftEnumProperty<>("enum.valued", SoftEnumValue.ofEnumValue(Example.ANOTHER), Example.class);
PropertyConfiguration config = configOf(Pair.of("enum.valued", "THIRD ONE"));
Assertions.assertEquals(SoftEnumValue.ofSoftValue("THIRD ONE"), 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 IntegerPropertiesTests method testValued.
@Test
public void testValued() throws InvalidPropertyException {
ValuedAlikeProperty<Integer> property = new IntegerProperty("integer.valued", 2);
PropertyConfiguration config = configOf(Pair.of("integer.valued", "5"));
Assertions.assertEquals(new Integer(5), config.getValue(property));
PropertyTestHelpUtil.assertAllHelpValid(property);
}
use of com.synopsys.integration.configuration.config.PropertyConfiguration in project synopsys-detect by blackducksoftware.
the class BooleanPropertiesTests method testNullable.
@Test
public void testNullable() throws InvalidPropertyException {
NullableAlikeProperty<Boolean> property = new NullableBooleanProperty("boolean.nullable");
PropertyConfiguration config = configOf(Pair.of("boolean.nullable", "true"));
Assertions.assertEquals(Optional.of(true), config.getValue(property));
PropertyTestHelpUtil.assertAllHelpValid(property);
}
use of com.synopsys.integration.configuration.config.PropertyConfiguration in project synopsys-detect by blackducksoftware.
the class LongPropertiesTests method testNullable.
@Test
public void testNullable() throws InvalidPropertyException {
NullableAlikeProperty<Long> property = new NullableLongProperty("long.nullable");
PropertyConfiguration config = configOf(Pair.of("long.nullable", "2"));
Assertions.assertEquals(Optional.of(2L), config.getValue(property));
PropertyTestHelpUtil.assertAllHelpValid(property);
}
Aggregations