use of com.synopsys.integration.configuration.config.PropertyConfiguration in project synopsys-detect by blackducksoftware.
the class AllNoneListPropertiesTests method testTwoValues.
@Test
public void testTwoValues() throws InvalidPropertyException {
AllNoneEnumListProperty<Example> property = new AllNoneEnumListProperty<>("enum.valued", new ArrayList<>(), Example.class);
PropertyConfiguration config = configOf(Pair.of("enum.valued", "thIrd,another"));
AllNoneEnumList<Example> list = config.getValue(property);
Assertions.assertFalse(list.containsNone());
Assertions.assertFalse(list.containsAll());
Assertions.assertEquals(list.toPresentValues().size(), 2, "Since 'third' was provided, it should be present.");
Assertions.assertEquals(list.toProvidedValues().size(), 2, "Should have two provided values of 'third' and 'another'.");
Assertions.assertEquals(list.representedValues().size(), 2, "Two values, 'third' and 'another', should be represented.");
Assertions.assertTrue(list.representedValues().contains(Example.THIRD));
Assertions.assertTrue(list.representedValues().contains(Example.ANOTHER));
}
use of com.synopsys.integration.configuration.config.PropertyConfiguration in project synopsys-detect by blackducksoftware.
the class NoneListPropertiesTests method testSingleValue.
@Test
public void testSingleValue() throws InvalidPropertyException {
NoneEnumListProperty<Example> property = new NoneEnumListProperty<>("enum.valued", new ArrayList<>(), Example.class);
PropertyConfiguration config = configOf(Pair.of("enum.valued", "thIrd"));
NoneEnumList<Example> list = config.getValue(property);
Assertions.assertFalse(list.containsNone());
Assertions.assertFalse(list.containsAll());
Assertions.assertEquals(list.toPresentValues().size(), 1, "Since 'third' was provided, it should be present.");
Assertions.assertEquals(list.toProvidedValues().size(), 1, "Should have single provided value of 'third'.");
Assertions.assertEquals(list.representedValues().size(), 1, "One value, 'third', should be represented.");
Assertions.assertTrue(list.representedValues().contains(Example.THIRD));
}
use of com.synopsys.integration.configuration.config.PropertyConfiguration in project synopsys-detect by blackducksoftware.
the class NoneListPropertiesTests method testAllThrows.
@Test()
public void testAllThrows() throws InvalidPropertyException {
NoneEnumListProperty<Example> property = new NoneEnumListProperty<>("enum.valued", new ArrayList<>(), Example.class);
PropertyConfiguration config = configOf(Pair.of("enum.valued", "aLL"));
Assertions.assertThrows(InvalidPropertyException.class, () -> config.getValue(property));
}
use of com.synopsys.integration.configuration.config.PropertyConfiguration in project synopsys-detect by blackducksoftware.
the class NoneListPropertiesTests method testNone.
@Test
public void testNone() throws InvalidPropertyException {
NoneEnumListProperty<Example> property = new NoneEnumListProperty<>("enum.valued", new ArrayList<>(), Example.class);
PropertyConfiguration config = configOf(Pair.of("enum.valued", "nOnE"));
NoneEnumList<Example> list = config.getValue(property);
Assertions.assertTrue(list.containsNone());
Assertions.assertFalse(list.containsAll());
Assertions.assertEquals(list.toPresentValues().size(), 0, "No 'actual' valaues of the enum are 'present'");
Assertions.assertEquals(list.toProvidedValues().size(), 1, "Should have single provided value of NONE.");
Assertions.assertEquals(list.representedValues().size(), 0, "No values should be represented by NONE.");
}
use of com.synopsys.integration.configuration.config.PropertyConfiguration in project synopsys-detect by blackducksoftware.
the class ExtendedEnumPropertiesTests method testNullable.
@Test
public void testNullable() throws InvalidPropertyException {
NullableAlikeProperty<ExtendedEnumValue<ExampleExtension, Example>> property = new NullableExtendedEnumProperty<>("enum.nullable", ExampleExtension.class, Example.class);
PropertyConfiguration config = configOf(Pair.of("enum.nullable", "NONE"));
Optional<ExtendedEnumValue<ExampleExtension, Example>> value = config.getValue(property);
Assertions.assertEquals(Optional.of(ExtendedEnumValue.ofExtendedValue(ExampleExtension.NONE)), value);
PropertyTestHelpUtil.assertAllHelpValid(property, Bds.listOf("THING", "ANOTHER", "THIRD", "NONE"));
}
Aggregations