Clover icon

jalviewX

  1. Project Clover database Wed Oct 31 2018 15:13:58 GMT
  2. Package jalview.util

File SetUtilsTest.java

 

Code metrics

0
21
1
1
46
34
1
0.05
21
1
1

Classes

Class Line # Actions
SetUtilsTest 11 21 1 0
1.0100%
 

Contributing tests

This file is covered by 1 test. .

Source view

1    package jalview.util;
2   
3    import static org.testng.Assert.assertEquals;
4   
5    import java.awt.Color;
6    import java.util.HashSet;
7    import java.util.Set;
8   
9    import org.testng.annotations.Test;
10   
 
11    public class SetUtilsTest
12    {
 
13  1 toggle @Test(groups = "Functional")
14    public void testCountDisjunction()
15    {
16  1 Set<Color> s1 = new HashSet<Color>();
17  1 assertEquals(SetUtils.countDisjunction(null, null), 0);
18  1 assertEquals(SetUtils.countDisjunction(s1, null), 0);
19  1 assertEquals(SetUtils.countDisjunction(null, s1), 0);
20  1 s1.add(Color.white);
21  1 assertEquals(SetUtils.countDisjunction(s1, null), 1);
22  1 assertEquals(SetUtils.countDisjunction(null, s1), 1);
23  1 assertEquals(SetUtils.countDisjunction(s1, null), 1);
24  1 assertEquals(SetUtils.countDisjunction(s1, s1), 0);
25   
26  1 Set<Object> s2 = new HashSet<Object>();
27  1 assertEquals(SetUtils.countDisjunction(s2, s2), 0);
28  1 assertEquals(SetUtils.countDisjunction(s1, s2), 1);
29  1 assertEquals(SetUtils.countDisjunction(s2, s1), 1);
30   
31  1 s1.add(Color.yellow);
32  1 s1.add(Color.blue);
33  1 s2.add(new Color(Color.yellow.getRGB()));
34   
35    /*
36    * now s1 is {white, yellow, blue}
37    * s2 is {yellow'}
38    */
39  1 assertEquals(SetUtils.countDisjunction(s1, s2), 2);
40  1 s2.add(Color.blue);
41  1 assertEquals(SetUtils.countDisjunction(s1, s2), 1);
42  1 s2.add(Color.pink);
43  1 assertEquals(SetUtils.countDisjunction(s1, s2), 2);
44   
45    }
46    }