### Question:
PropertySet { @SuppressWarnings("unchecked") public <T> Property<T> getProperty(PropertyDefinition<T> d) throws IllegalArgumentException { if (!properties.containsKey(d)) { throw new IllegalArgumentException("Unknown property " + d.getName()); } return (Property<T>) properties.get(d); } PropertySet(); void addProperty(PropertyDefinition<T> pd,
      Collection<T> defaultValues, Collection<T> activeValues); @SuppressWarnings("unchecked") Property<T> getProperty(PropertyDefinition<T> d); @Override String toString();  }### Answer:
@Test(dataProvider = "propertyDefinitionAndValuesData") public <T> void testGetActiveValues(final PropertyDefinition<T> pd, final Collection<T> values) { PropertyProvider pp = new TestPropertyProvider<>(pd, values); PropertySet ps = createTestPropertySet(pp); Property<T> p = ps.getProperty(pd); SortedSet<T> ss = p.getActiveValues(); assertEquals(ss.size(), values.size()); for (T v : values) { assertTrue(ss.contains(v)); } }
@Test(dataProvider = "defaultData") public <T> void testGetDefaultValues(PropertyDefinition<T> pd, Set<T> expected) { PropertySet ps = createTestPropertySet(); Property<T> p = ps.getProperty(pd); SortedSet<T> ss = p.getDefaultValues(); assertEquals(ss.size(), expected.size()); for (T v : expected) { assertTrue(ss.contains(v), "does not contain " + v); } }
@Test(dataProvider = "propertyDefinitionData") public <T> void testGetPropertyDefinition(PropertyDefinition<T> pd) { PropertySet ps = createTestPropertySet(); Property<T> p = ps.getProperty(pd); PropertyDefinition<T> pd2 = p.getPropertyDefinition(); assertEquals(pd, pd2); }
@Test(dataProvider = "propertyDefinitionData") public <T> void testWasEmpty(PropertyDefinition<T> pd) { PropertySet ps = createTestPropertySet(emptyPropertyProvider); Property<T> p = ps.getProperty(pd); assertTrue(p.wasEmpty()); }