### Question:
ConstraintNode implements Node { public ConstraintNode(Set<AtomicConstraint> atomicConstraints, Set<FieldSpecRelation> relations, Set<DecisionNode> decisions, Set<NodeMarking> nodeMarkings) { this.atomicConstraints = Collections.unmodifiableSet(atomicConstraints); this.relations = Collections.unmodifiableSet(relations); this.decisions = Collections.unmodifiableSet(decisions); this.nodeMarkings = Collections.unmodifiableSet(nodeMarkings); } ConstraintNode(Set<AtomicConstraint> atomicConstraints,
                          Set<FieldSpecRelation> relations,
                          Set<DecisionNode> decisions,
                          Set<NodeMarking> nodeMarkings); Set<AtomicConstraint> getAtomicConstraints(); Set<FieldSpecRelation> getRelations(); Set<DecisionNode> getDecisions(); String toString(); ConstraintNodeBuilder builder(); @Override boolean hasMarking(NodeMarking detail); @Override boolean equals(Object o); @Override int hashCode();  }### Answer:
@Test public void equals_identicalConstraintNodesDifferentReferences_isTrue() { ConstraintNode constraintNode1 = constraintNode() .where(A).isInSet("a1", "a2") .where(B).isInSet("b1", "b2") .withDecision( constraintNode() .where(A).isInSet("a1") .withDecision( constraintNode() .where(B).isInSet("b1"), constraintNode() .where(B).isNotInSet("b1")), constraintNode() .where(A).isNotInSet("a1")) .build(); ConstraintNode constraintNode2 = constraintNode() .where(A).isInSet("a1", "a2") .where(B).isInSet("b1", "b2") .withDecision( constraintNode() .where(A).isInSet("a1") .withDecision( constraintNode() .where(B).isInSet("b1"), constraintNode() .where(B).isNotInSet("b1")), constraintNode() .where(A).isNotInSet("a1")) .build(); assertEquals(constraintNode1, constraintNode2); }
@Test public void equals_differentConstraintNodesDifferentReferences_isFalse() { ConstraintNode constraintNode1 = constraintNode() .where(A).isInSet("a1", "a2") .where(B).isInSet("b1", "b2") .withDecision( constraintNode() .where(A).isInSet("a1") .withDecision( constraintNode() .where(B).isInSet("b2"), constraintNode() .where(B).isNotInSet("b1")), constraintNode() .where(A).isNotInSet("a1")) .build(); ConstraintNode constraintNode2 = constraintNode() .where(A).isInSet("a1", "a2") .where(B).isInSet("b1", "b2") .withDecision( constraintNode() .where(A).isInSet("a1") .withDecision( constraintNode() .where(B).isInSet("b1"), constraintNode() .where(B).isNotInSet("b1")), constraintNode() .where(A).isNotInSet("a1")) .build(); assertNotEquals(constraintNode1, constraintNode2); }