### Question:
DecisionTree { private Constraint<T> getConstraint(String name) throws XmlParseException { Class<? extends Constraint<T>> constraintClass = constraintClassMap.get(name); if (constraintClass == null) { return null; } try { return constraintClass.newInstance(); } catch (Exception e) { throw new XmlParseException( "Can't create constraint instance for class " + constraintClass.getName(), e); } } DecisionTree(); DecisionSet getDecisionsSet(T testObject, String propertyName); void registerConstraintType(String name, Class<? extends Constraint<T>> constraintClass); void registerPropertyName(String propertyName); void loadConstraints(String name, InputStream stream); void loadConstraints(ResourceFile file);  }### Answer:
@Test public void testTreeBuild() { @SuppressWarnings("unchecked") DecisionNode<Color> root = (DecisionNode<Color>) getInstanceField("root", decisionTree); List<DecisionNode<Color>> children = getChildren(root); assertEquals(3, children.size()); DecisionNode<Color> child = children.get(0); Constraint<Color> constraint = getConstraint(child); assertTrue(constraint instanceof RedColorConstraint); assertTrue(getPropertyMap(child).isEmpty()); List<DecisionNode<Color>> grandChildren = getChildren(child); assertEquals(2, grandChildren.size()); DecisionNode<Color> grandChild = grandChildren.get(0); constraint = getConstraint(grandChild); assertTrue(constraint instanceof BlueColorConstraint); assertTrue(getPropertyMap(grandChild).isEmpty()); List<DecisionNode<Color>> grandGrandChildren = getChildren(grandChild); assertEquals(2, grandGrandChildren.size()); DecisionNode<Color> grandGrandChild = grandGrandChildren.get(0); constraint = getConstraint(grandGrandChild); assertTrue(constraint instanceof GreenColorConstraint); assertTrue(getChildren(grandGrandChild).isEmpty()); Map<String, PropertyValue> propertyMap = getPropertyMap(grandGrandChild); assertEquals("WHITE", propertyMap.get("NAME").value); }