@Test
public void testDomainChanges() {
Domain colors2 = new Domain(colors.asList());
Assert.assertEquals(colors, colors2);
CSP csp = new CSP(variables);
csp.addConstraint(C1);
Assert.assertNotNull(csp.getDomain(X));
Assert.assertEquals(0, csp.getDomain(X).size());
Assert.assertNotNull(csp.getConstraints(X));
csp.setDomain(X, colors);
Assert.assertEquals(colors, csp.getDomain(X));
Assert.assertEquals(3, csp.getDomain(X).size());
Assert.assertEquals("red", csp.getDomain(X).get(0));
CSP cspCopy = csp.copyDomains();
Assert.assertNotNull(cspCopy.getDomain(X));
Assert.assertEquals(3, cspCopy.getDomain(X).size());
Assert.assertEquals("red", cspCopy.getDomain(X).get(0));
Assert.assertNotNull(cspCopy.getDomain(Y));
Assert.assertEquals(0, cspCopy.getDomain(Y).size());
Assert.assertNotNull(cspCopy.getConstraints(X));
Assert.assertEquals(C1, cspCopy.getConstraints(X).get(0));
cspCopy.removeValueFromDomain(X, "red");
Assert.assertEquals(2, cspCopy.getDomain(X).size());
Assert.assertEquals("green", cspCopy.getDomain(X).get(0));
Assert.assertEquals(3, csp.getDomain(X).size());
Assert.assertEquals("red", csp.getDomain(X).get(0));
cspCopy.setDomain(X, animals);
Assert.assertEquals(2, cspCopy.getDomain(X).size());
Assert.assertEquals("cat", cspCopy.getDomain(X).get(0));
Assert.assertEquals(3, csp.getDomain(X).size());
Assert.assertEquals("red", csp.getDomain(X).get(0));
}