1 |
|
package jalview.structure; |
2 |
|
|
3 |
|
import static org.testng.Assert.assertEquals; |
4 |
|
import static org.testng.Assert.assertNull; |
5 |
|
import static org.testng.Assert.fail; |
6 |
|
|
7 |
|
import org.testng.annotations.Test; |
8 |
|
|
|
|
| 0% |
Uncovered Elements: 64 (64) |
Complexity: 10 |
Complexity Density: 0.16 |
|
9 |
|
public class AtomSpecTest |
10 |
|
{ |
|
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 5 |
Complexity Density: 0.16 |
4-
|
|
11 |
0 |
@Test... |
12 |
|
public void testFromChimeraAtomSpec() |
13 |
|
{ |
14 |
0 |
AtomSpec as = AtomSpec.fromChimeraAtomspec("#1:12.B"); |
15 |
0 |
assertEquals(as.getModelNumber(), 1); |
16 |
0 |
assertEquals(as.getPdbResNum(), 12); |
17 |
0 |
assertEquals(as.getChain(), "B"); |
18 |
0 |
assertNull(as.getPdbFile()); |
19 |
|
|
20 |
|
|
21 |
0 |
as = AtomSpec.fromChimeraAtomspec(":13.C"); |
22 |
0 |
assertEquals(as.getModelNumber(), 0); |
23 |
0 |
assertEquals(as.getPdbResNum(), 13); |
24 |
0 |
assertEquals(as.getChain(), "C"); |
25 |
0 |
assertNull(as.getPdbFile()); |
26 |
|
|
27 |
|
|
28 |
0 |
as = AtomSpec.fromChimeraAtomspec("#3.2:15"); |
29 |
0 |
assertEquals(as.getModelNumber(), 3); |
30 |
0 |
assertEquals(as.getPdbResNum(), 15); |
31 |
0 |
assertEquals(as.getChain(), ""); |
32 |
0 |
assertNull(as.getPdbFile()); |
33 |
|
|
34 |
0 |
String spec = "3:12.B"; |
35 |
0 |
try |
36 |
|
{ |
37 |
0 |
as = AtomSpec.fromChimeraAtomspec(spec); |
38 |
0 |
fail("Expected exception for " + spec); |
39 |
|
} catch (IllegalArgumentException e) |
40 |
|
{ |
41 |
|
|
42 |
|
} |
43 |
|
|
44 |
0 |
spec = "#3:12-14.B"; |
45 |
0 |
try |
46 |
|
{ |
47 |
0 |
as = AtomSpec.fromChimeraAtomspec(spec); |
48 |
0 |
fail("Expected exception for " + spec); |
49 |
|
} catch (IllegalArgumentException e) |
50 |
|
{ |
51 |
|
|
52 |
|
} |
53 |
|
|
54 |
0 |
spec = ""; |
55 |
0 |
try |
56 |
|
{ |
57 |
0 |
as = AtomSpec.fromChimeraAtomspec(spec); |
58 |
0 |
fail("Expected exception for " + spec); |
59 |
|
} catch (IllegalArgumentException e) |
60 |
|
{ |
61 |
|
|
62 |
|
} |
63 |
|
|
64 |
0 |
spec = null; |
65 |
0 |
try |
66 |
|
{ |
67 |
0 |
as = AtomSpec.fromChimeraAtomspec(spec); |
68 |
0 |
fail("Expected exception for " + spec); |
69 |
|
} catch (NullPointerException e) |
70 |
|
{ |
71 |
|
|
72 |
|
} |
73 |
|
} |
74 |
|
|
|
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 5 |
Complexity Density: 0.16 |
4-
|
|
75 |
0 |
@Test... |
76 |
|
public void testFromChimeraXAtomSpec() |
77 |
|
{ |
78 |
0 |
AtomSpec as = AtomSpec.fromChimeraXAtomspec("#1/B:12"); |
79 |
0 |
assertEquals(as.getModelNumber(), 1); |
80 |
0 |
assertEquals(as.getPdbResNum(), 12); |
81 |
0 |
assertEquals(as.getChain(), "B"); |
82 |
0 |
assertNull(as.getPdbFile()); |
83 |
|
|
84 |
|
|
85 |
0 |
as = AtomSpec.fromChimeraXAtomspec("/C:13"); |
86 |
0 |
assertEquals(as.getModelNumber(), 0); |
87 |
0 |
assertEquals(as.getPdbResNum(), 13); |
88 |
0 |
assertEquals(as.getChain(), "C"); |
89 |
0 |
assertNull(as.getPdbFile()); |
90 |
|
|
91 |
|
|
92 |
0 |
as = AtomSpec.fromChimeraXAtomspec("#3.2/:15"); |
93 |
0 |
assertEquals(as.getModelNumber(), 3); |
94 |
0 |
assertEquals(as.getPdbResNum(), 15); |
95 |
0 |
assertEquals(as.getChain(), ""); |
96 |
0 |
assertNull(as.getPdbFile()); |
97 |
|
|
98 |
0 |
String spec = "3:12.B"; |
99 |
0 |
try |
100 |
|
{ |
101 |
0 |
as = AtomSpec.fromChimeraXAtomspec(spec); |
102 |
0 |
fail("Expected exception for " + spec); |
103 |
|
} catch (IllegalArgumentException e) |
104 |
|
{ |
105 |
|
|
106 |
|
} |
107 |
|
|
108 |
0 |
spec = "#3:12-14.B"; |
109 |
0 |
try |
110 |
|
{ |
111 |
0 |
as = AtomSpec.fromChimeraXAtomspec(spec); |
112 |
0 |
fail("Expected exception for " + spec); |
113 |
|
} catch (IllegalArgumentException e) |
114 |
|
{ |
115 |
|
|
116 |
|
} |
117 |
|
|
118 |
0 |
spec = ""; |
119 |
0 |
try |
120 |
|
{ |
121 |
0 |
as = AtomSpec.fromChimeraXAtomspec(spec); |
122 |
0 |
fail("Expected exception for " + spec); |
123 |
|
} catch (IllegalArgumentException e) |
124 |
|
{ |
125 |
|
|
126 |
|
} |
127 |
|
|
128 |
0 |
spec = null; |
129 |
0 |
try |
130 |
|
{ |
131 |
0 |
as = AtomSpec.fromChimeraXAtomspec(spec); |
132 |
0 |
fail("Expected exception for " + spec); |
133 |
|
} catch (NullPointerException e) |
134 |
|
{ |
135 |
|
|
136 |
|
} |
137 |
|
} |
138 |
|
} |