Clover icon

Coverage Report

  1. Project Clover database Thu Nov 7 2024 17:01:39 GMT
  2. Package jalview.util.matcher

File ConditionTest.java

 

Code metrics

0
43
3
1
96
64
3
0.07
14.33
3
1

Classes

Class Line # Actions
ConditionTest 30 43 3
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
4    *
5    * This file is part of Jalview.
6    *
7    * Jalview is free software: you can redistribute it and/or
8    * modify it under the terms of the GNU General Public License
9    * as published by the Free Software Foundation, either version 3
10    * of the License, or (at your option) any later version.
11    *
12    * Jalview is distributed in the hope that it will be useful, but
13    * WITHOUT ANY WARRANTY; without even the implied warranty
14    * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15    * PURPOSE. See the GNU General Public License for more details.
16    *
17    * You should have received a copy of the GNU General Public License
18    * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19    * The Jalview Authors are detailed in the 'AUTHORS' file.
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   
 
30    public class ConditionTest
31    {
 
32  0 toggle @Test(groups = "Functional")
33    public void testToString()
34    {
35  0 Locale.setDefault(Locale.UK);
36  0 assertEquals(Condition.Contains.toString(), "Contains");
37  0 assertEquals(Condition.NotContains.toString(), "Does not contain");
38  0 assertEquals(Condition.Matches.toString(), "Matches");
39  0 assertEquals(Condition.NotMatches.toString(), "Does not match");
40  0 assertEquals(Condition.Present.toString(), "Is present");
41  0 assertEquals(Condition.NotPresent.toString(), "Is not present");
42  0 assertEquals(Condition.LT.toString(), "<");
43  0 assertEquals(Condition.LE.toString(), "<=");
44  0 assertEquals(Condition.GT.toString(), ">");
45  0 assertEquals(Condition.GE.toString(), ">=");
46  0 assertEquals(Condition.EQ.toString(), "=");
47  0 assertEquals(Condition.NE.toString(), "not =");
48   
49    /*
50    * repeat call to get coverage of value caching
51    */
52  0 assertEquals(Condition.NE.toString(), "not =");
53    }
54   
 
55  0 toggle @Test(groups = "Functional")
56    public void testGetStableName()
57    {
58  0 assertEquals(Condition.Contains.getStableName(), "Contains");
59  0 assertEquals(Condition.NotContains.getStableName(), "NotContains");
60  0 assertEquals(Condition.Matches.getStableName(), "Matches");
61  0 assertEquals(Condition.NotMatches.getStableName(), "NotMatches");
62  0 assertEquals(Condition.Present.getStableName(), "Present");
63  0 assertEquals(Condition.NotPresent.getStableName(), "NotPresent");
64  0 assertEquals(Condition.LT.getStableName(), "LT");
65  0 assertEquals(Condition.LE.getStableName(), "LE");
66  0 assertEquals(Condition.GT.getStableName(), "GT");
67  0 assertEquals(Condition.GE.getStableName(), "GE");
68  0 assertEquals(Condition.EQ.getStableName(), "EQ");
69  0 assertEquals(Condition.NE.getStableName(), "NE");
70    }
71   
 
72  0 toggle @Test(groups = "Functional")
73    public void testFromString()
74    {
75  0 assertEquals(Condition.fromString("Contains"), Condition.Contains);
76    // not case sensitive
77  0 assertEquals(Condition.fromString("contains"), Condition.Contains);
78  0 assertEquals(Condition.fromString("CONTAINS"), Condition.Contains);
79  0 assertEquals(Condition.fromString("NotContains"),
80    Condition.NotContains);
81  0 assertEquals(Condition.fromString("Matches"), Condition.Matches);
82  0 assertEquals(Condition.fromString("NotMatches"), Condition.NotMatches);
83  0 assertEquals(Condition.fromString("Present"), Condition.Present);
84  0 assertEquals(Condition.fromString("NotPresent"), Condition.NotPresent);
85  0 assertEquals(Condition.fromString("LT"), Condition.LT);
86  0 assertEquals(Condition.fromString("LE"), Condition.LE);
87  0 assertEquals(Condition.fromString("GT"), Condition.GT);
88  0 assertEquals(Condition.fromString("GE"), Condition.GE);
89  0 assertEquals(Condition.fromString("EQ"), Condition.EQ);
90  0 assertEquals(Condition.fromString("NE"), Condition.NE);
91   
92  0 assertNull(Condition.fromString("Equals"));
93  0 assertNull(Condition.fromString(""));
94  0 assertNull(Condition.fromString(null));
95    }
96    }