1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.gui; |
22 |
|
|
23 |
|
import static org.testng.Assert.assertEquals; |
24 |
|
import static org.testng.Assert.assertNull; |
25 |
|
|
26 |
|
import jalview.datamodel.AlignmentAnnotation; |
27 |
|
import jalview.datamodel.Sequence; |
28 |
|
|
29 |
|
import org.testng.annotations.Test; |
30 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (54) |
Complexity: 2 |
Complexity Density: 0.04 |
|
31 |
|
public class AnnotationLabelsTest |
32 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (40) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
33 |
1 |
@Test(groups = "Functional")... |
34 |
|
public void testGetTooltip() |
35 |
|
{ |
36 |
1 |
assertNull(AnnotationLabels.getTooltip(null)); |
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
1 |
AlignmentAnnotation ann = new AlignmentAnnotation("thelabel", "thedesc", |
42 |
|
null); |
43 |
1 |
String expected = "<html>thedesc</html>"; |
44 |
1 |
assertEquals(AnnotationLabels.getTooltip(ann), expected); |
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
1 |
ann.description = "TCoffee scores < 56 and > 28"; |
51 |
1 |
expected = "<html>TCoffee scores < 56 and > 28</html>"; |
52 |
1 |
assertEquals(AnnotationLabels.getTooltip(ann), expected); |
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
1 |
ann.description = "<html>hello world</html>"; |
58 |
1 |
assertEquals(AnnotationLabels.getTooltip(ann), ann.description); |
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
|
63 |
1 |
ann.description = "hello world"; |
64 |
1 |
ann.setScore(2.34d); |
65 |
1 |
expected = "<html>hello world<br/> Score: 2.34</html>"; |
66 |
1 |
assertEquals(AnnotationLabels.getTooltip(ann), expected); |
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
1 |
ann.description = "<html>hello world</html>"; |
72 |
1 |
ann.setScore(2.34d); |
73 |
1 |
expected = "<html>hello world<br/> Score: 2.34</html>"; |
74 |
1 |
assertEquals(AnnotationLabels.getTooltip(ann), expected); |
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
1 |
ann.description = " "; |
80 |
1 |
assertEquals(AnnotationLabels.getTooltip(ann), |
81 |
|
"<html> Score: 2.34</html>"); |
82 |
1 |
ann.description = null; |
83 |
1 |
assertEquals(AnnotationLabels.getTooltip(ann), |
84 |
|
"<html> Score: 2.34</html>"); |
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
|
89 |
1 |
ann.description = "Count < 12"; |
90 |
1 |
ann.sequenceRef = new Sequence("Seq1", "MLRIQST"); |
91 |
1 |
ann.hasScore = false; |
92 |
1 |
ann.score = Double.NaN; |
93 |
1 |
expected = "<html>Seq1 : Count < 12</html>"; |
94 |
1 |
assertEquals(AnnotationLabels.getTooltip(ann), expected); |
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
1 |
ann.description = "<html>Score < 4.8</html>"; |
100 |
1 |
ann.sequenceRef = new Sequence("Seq1", "MLRIQST"); |
101 |
1 |
ann.setScore(-2.1D); |
102 |
1 |
expected = "<html>Seq1 : Score < 4.8<br/> Score: -2.1</html>"; |
103 |
1 |
assertEquals(AnnotationLabels.getTooltip(ann), expected); |
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
1 |
ann.description = null; |
109 |
1 |
ann.hasScore = false; |
110 |
1 |
ann.score = Double.NaN; |
111 |
1 |
assertNull(AnnotationLabels.getTooltip(ann)); |
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
|
116 |
1 |
ann.description = ""; |
117 |
1 |
assertEquals(AnnotationLabels.getTooltip(ann), "<html>Seq1 :</html>"); |
118 |
|
|
119 |
|
|
120 |
|
|
121 |
|
|
122 |
1 |
ann.sequenceRef = null; |
123 |
1 |
assertNull(AnnotationLabels.getTooltip(ann)); |
124 |
|
} |
125 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
126 |
1 |
@Test(groups = "Functional")... |
127 |
|
public void testGetStatusMessage() |
128 |
|
{ |
129 |
1 |
assertNull(AnnotationLabels.getStatusMessage(null, null)); |
130 |
|
|
131 |
|
|
132 |
|
|
133 |
|
|
134 |
1 |
AlignmentAnnotation aa = new AlignmentAnnotation("IUPredWS Short", |
135 |
|
"Protein disorder", null); |
136 |
1 |
assertEquals(AnnotationLabels.getStatusMessage(aa, null), |
137 |
|
"IUPredWS Short"); |
138 |
|
|
139 |
|
|
140 |
|
|
141 |
|
|
142 |
1 |
aa.setSequenceRef(new Sequence("FER_CAPAA", "MIGRKQL")); |
143 |
1 |
assertEquals(AnnotationLabels.getStatusMessage(aa, null), |
144 |
|
"FER_CAPAA : IUPredWS Short"); |
145 |
|
|
146 |
|
|
147 |
|
|
148 |
|
|
149 |
1 |
aa.graphGroup = 1; |
150 |
1 |
AlignmentAnnotation aa2 = new AlignmentAnnotation("IUPredWS Long", |
151 |
|
"Protein disorder", null); |
152 |
1 |
assertEquals( |
153 |
|
AnnotationLabels.getStatusMessage(aa, new AlignmentAnnotation[] |
154 |
|
{ aa, aa2 }), "FER_CAPAA : IUPredWS Short"); |
155 |
|
|
156 |
|
|
157 |
|
|
158 |
|
|
159 |
|
|
160 |
1 |
aa2.graphGroup = 1; |
161 |
1 |
assertEquals( |
162 |
|
AnnotationLabels.getStatusMessage(aa, new AlignmentAnnotation[] |
163 |
|
{ aa, aa2 }), "FER_CAPAA : IUPredWS Long, IUPredWS Short"); |
164 |
|
|
165 |
|
|
166 |
|
|
167 |
|
|
168 |
1 |
aa.sequenceRef = null; |
169 |
1 |
assertEquals( |
170 |
|
AnnotationLabels.getStatusMessage(aa, new AlignmentAnnotation[] |
171 |
|
{ aa, aa2 }), "IUPredWS Long, IUPredWS Short"); |
172 |
|
} |
173 |
|
} |