3 import static org.testng.Assert.assertEquals;
6 import java.util.HashSet;
9 import org.testng.annotations.Test;
11 public class SetUtilsTest
13 @Test(groups = "Functional")
14 public void testCountDisjunction()
16 Set<Color> s1 = new HashSet<Color>();
17 assertEquals(SetUtils.countDisjunction(null, null), 0);
18 assertEquals(SetUtils.countDisjunction(s1, null), 0);
19 assertEquals(SetUtils.countDisjunction(null, s1), 0);
21 assertEquals(SetUtils.countDisjunction(s1, null), 1);
22 assertEquals(SetUtils.countDisjunction(null, s1), 1);
23 assertEquals(SetUtils.countDisjunction(s1, null), 1);
24 assertEquals(SetUtils.countDisjunction(s1, s1), 0);
26 Set<Object> s2 = new HashSet<Object>();
27 assertEquals(SetUtils.countDisjunction(s2, s2), 0);
28 assertEquals(SetUtils.countDisjunction(s1, s2), 1);
29 assertEquals(SetUtils.countDisjunction(s2, s1), 1);
33 s2.add(new Color(Color.yellow.getRGB()));
36 * now s1 is {white, yellow, blue}
39 assertEquals(SetUtils.countDisjunction(s1, s2), 2);
41 assertEquals(SetUtils.countDisjunction(s1, s2), 1);
43 assertEquals(SetUtils.countDisjunction(s1, s2), 2);