1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.util.matcher; |
22 |
|
|
23 |
|
import static org.testng.Assert.assertEquals; |
24 |
|
import static org.testng.Assert.assertNull; |
25 |
|
|
26 |
|
import java.util.Locale; |
27 |
|
|
28 |
|
import org.testng.annotations.Test; |
29 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (46) |
Complexity: 3 |
Complexity Density: 0.07 |
|
30 |
|
public class ConditionTest |
31 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
32 |
1 |
@Test(groups = "Functional")... |
33 |
|
public void testToString() |
34 |
|
{ |
35 |
1 |
Locale.setDefault(Locale.UK); |
36 |
1 |
assertEquals(Condition.Contains.toString(), "Contains"); |
37 |
1 |
assertEquals(Condition.NotContains.toString(), "Does not contain"); |
38 |
1 |
assertEquals(Condition.Matches.toString(), "Matches"); |
39 |
1 |
assertEquals(Condition.NotMatches.toString(), "Does not match"); |
40 |
1 |
assertEquals(Condition.Present.toString(), "Is present"); |
41 |
1 |
assertEquals(Condition.NotPresent.toString(), "Is not present"); |
42 |
1 |
assertEquals(Condition.LT.toString(), "<"); |
43 |
1 |
assertEquals(Condition.LE.toString(), "<="); |
44 |
1 |
assertEquals(Condition.GT.toString(), ">"); |
45 |
1 |
assertEquals(Condition.GE.toString(), ">="); |
46 |
1 |
assertEquals(Condition.EQ.toString(), "="); |
47 |
1 |
assertEquals(Condition.NE.toString(), "not ="); |
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
1 |
assertEquals(Condition.NE.toString(), "not ="); |
53 |
|
} |
54 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
55 |
1 |
@Test(groups = "Functional")... |
56 |
|
public void testGetStableName() |
57 |
|
{ |
58 |
1 |
assertEquals(Condition.Contains.getStableName(), "Contains"); |
59 |
1 |
assertEquals(Condition.NotContains.getStableName(), "NotContains"); |
60 |
1 |
assertEquals(Condition.Matches.getStableName(), "Matches"); |
61 |
1 |
assertEquals(Condition.NotMatches.getStableName(), "NotMatches"); |
62 |
1 |
assertEquals(Condition.Present.getStableName(), "Present"); |
63 |
1 |
assertEquals(Condition.NotPresent.getStableName(), "NotPresent"); |
64 |
1 |
assertEquals(Condition.LT.getStableName(), "LT"); |
65 |
1 |
assertEquals(Condition.LE.getStableName(), "LE"); |
66 |
1 |
assertEquals(Condition.GT.getStableName(), "GT"); |
67 |
1 |
assertEquals(Condition.GE.getStableName(), "GE"); |
68 |
1 |
assertEquals(Condition.EQ.getStableName(), "EQ"); |
69 |
1 |
assertEquals(Condition.NE.getStableName(), "NE"); |
70 |
|
} |
71 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (17) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
72 |
1 |
@Test(groups = "Functional")... |
73 |
|
public void testFromString() |
74 |
|
{ |
75 |
1 |
assertEquals(Condition.fromString("Contains"), Condition.Contains); |
76 |
|
|
77 |
1 |
assertEquals(Condition.fromString("contains"), Condition.Contains); |
78 |
1 |
assertEquals(Condition.fromString("CONTAINS"), Condition.Contains); |
79 |
1 |
assertEquals(Condition.fromString("NotContains"), |
80 |
|
Condition.NotContains); |
81 |
1 |
assertEquals(Condition.fromString("Matches"), Condition.Matches); |
82 |
1 |
assertEquals(Condition.fromString("NotMatches"), Condition.NotMatches); |
83 |
1 |
assertEquals(Condition.fromString("Present"), Condition.Present); |
84 |
1 |
assertEquals(Condition.fromString("NotPresent"), Condition.NotPresent); |
85 |
1 |
assertEquals(Condition.fromString("LT"), Condition.LT); |
86 |
1 |
assertEquals(Condition.fromString("LE"), Condition.LE); |
87 |
1 |
assertEquals(Condition.fromString("GT"), Condition.GT); |
88 |
1 |
assertEquals(Condition.fromString("GE"), Condition.GE); |
89 |
1 |
assertEquals(Condition.fromString("EQ"), Condition.EQ); |
90 |
1 |
assertEquals(Condition.fromString("NE"), Condition.NE); |
91 |
|
|
92 |
1 |
assertNull(Condition.fromString("Equals")); |
93 |
1 |
assertNull(Condition.fromString("")); |
94 |
1 |
assertNull(Condition.fromString(null)); |
95 |
|
} |
96 |
|
} |