1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.analysis; |
22 |
|
|
23 |
|
import static org.testng.AssertJUnit.assertFalse; |
24 |
|
import static org.testng.AssertJUnit.assertTrue; |
25 |
|
|
26 |
|
import jalview.analysis.SequenceIdMatcher.SeqIdName; |
27 |
|
import jalview.datamodel.SequenceI; |
28 |
|
import jalview.gui.JvOptionPane; |
29 |
|
|
30 |
|
import org.testng.annotations.BeforeClass; |
31 |
|
import org.testng.annotations.Test; |
32 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (53) |
Complexity: 2 |
Complexity Density: 0.04 |
|
33 |
|
public class SequenceIdMatcherTest |
34 |
|
{ |
35 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
36 |
1 |
@BeforeClass(alwaysRun = true)... |
37 |
|
public void setUpJvOptionPane() |
38 |
|
{ |
39 |
1 |
JvOptionPane.setInteractiveMode(false); |
40 |
1 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
41 |
|
} |
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (49) |
Complexity: 1 |
Complexity Density: 0.02 |
1PASS
|
|
47 |
1 |
@Test(groups = "Functional")... |
48 |
|
public void test_seqIdNameEquals() |
49 |
|
{ |
50 |
1 |
SequenceIdMatcher sequenceIdMatcher = new SequenceIdMatcher( |
51 |
|
new SequenceI[] {}); |
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
1 |
SeqIdName testee = sequenceIdMatcher.new SeqIdName("A12345"); |
57 |
1 |
assertTrue(testee.equals("A12345")); |
58 |
1 |
assertTrue(testee.equals("A12345~")); |
59 |
1 |
assertTrue(testee.equals("A12345.")); |
60 |
1 |
assertTrue(testee.equals("A12345 ")); |
61 |
1 |
assertTrue(testee.equals("A12345|")); |
62 |
1 |
assertTrue(testee.equals("A12345#")); |
63 |
1 |
assertTrue(testee.equals("A12345\\")); |
64 |
1 |
assertTrue(testee.equals("A12345/")); |
65 |
1 |
assertTrue(testee.equals("A12345<")); |
66 |
1 |
assertTrue(testee.equals("A12345>")); |
67 |
1 |
assertTrue(testee.equals("A12345!")); |
68 |
1 |
assertTrue(testee.equals("A12345\"")); |
69 |
1 |
assertTrue(testee.equals("A12345" + String.valueOf((char) 0x00A4))); |
70 |
1 |
assertTrue(testee.equals("A12345$a")); |
71 |
1 |
assertTrue(testee.equals("A12345%b")); |
72 |
1 |
assertTrue(testee.equals("A12345^cd")); |
73 |
1 |
assertTrue(testee.equals("A12345*efg")); |
74 |
1 |
assertTrue(testee.equals("A12345)^&!")); |
75 |
1 |
assertTrue(testee.equals("A12345}01&*")); |
76 |
1 |
assertTrue(testee.equals("A12345[A23456")); |
77 |
1 |
assertTrue(testee.equals("A12345@|Uniprot")); |
78 |
1 |
assertTrue(testee.equals("A12345'whatever you want here")); |
79 |
1 |
assertTrue(testee.equals("A12345,")); |
80 |
1 |
assertTrue(testee.equals("A12345?")); |
81 |
1 |
assertTrue(testee.equals("A12345_")); |
82 |
|
|
83 |
|
|
84 |
|
|
85 |
1 |
assertTrue(testee.equals("a12345")); |
86 |
|
|
87 |
|
|
88 |
|
|
89 |
|
|
90 |
1 |
testee = sequenceIdMatcher.new SeqIdName("A12345#"); |
91 |
1 |
assertTrue(testee.equals("A12345")); |
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
|
96 |
1 |
assertTrue(testee.equals("a12345")); |
97 |
|
|
98 |
|
|
99 |
|
|
100 |
|
|
101 |
1 |
testee = sequenceIdMatcher.new SeqIdName("A12345"); |
102 |
1 |
assertFalse(testee.equals((Object) null)); |
103 |
1 |
assertFalse(testee.equals("")); |
104 |
1 |
assertFalse(testee.equals("A12346|A12345")); |
105 |
|
|
106 |
|
|
107 |
|
|
108 |
1 |
assertTrue(testee.equals("a12345")); |
109 |
|
|
110 |
1 |
testee = sequenceIdMatcher.new SeqIdName("A12345?B23456"); |
111 |
1 |
assertFalse(testee.equals("B23456")); |
112 |
1 |
assertFalse(testee.equals("A12345|")); |
113 |
1 |
assertFalse(testee.equals("A12345?")); |
114 |
|
|
115 |
1 |
testee = sequenceIdMatcher.new SeqIdName("A12345<"); |
116 |
1 |
assertFalse(testee.equals("A12345?")); |
117 |
1 |
assertTrue(testee.equals("A12345<")); |
118 |
|
|
119 |
|
|
120 |
|
|
121 |
1 |
assertTrue(testee.equals("a12345")); |
122 |
|
|
123 |
1 |
testee = sequenceIdMatcher.new SeqIdName("UNIPROT|A12345"); |
124 |
1 |
assertFalse(testee.equals("A12345")); |
125 |
1 |
assertFalse(testee.equals("UNIPROT|B98765")); |
126 |
1 |
assertFalse(testee.equals("UNIPROT|")); |
127 |
1 |
assertTrue(testee.equals("UNIPROT")); |
128 |
|
} |
129 |
|
} |