1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package mc_view; |
22 |
|
|
23 |
|
import static org.testng.AssertJUnit.assertEquals; |
24 |
|
|
25 |
|
import jalview.gui.JvOptionPane; |
26 |
|
|
27 |
|
import org.testng.Assert; |
28 |
|
import org.testng.annotations.BeforeClass; |
29 |
|
import org.testng.annotations.Test; |
30 |
|
|
|
|
| 96% |
Uncovered Elements: 1 (25) |
Complexity: 5 |
Complexity Density: 0.24 |
|
31 |
|
public class AtomTest |
32 |
|
{ |
33 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
34 |
1 |
@BeforeClass(alwaysRun = true)... |
35 |
|
public void setUpJvOptionPane() |
36 |
|
{ |
37 |
1 |
JvOptionPane.setInteractiveMode(false); |
38 |
1 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
39 |
|
} |
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
45 |
1 |
@Test(groups = { "Functional" })... |
46 |
|
public void testStringConstructor() |
47 |
|
{ |
48 |
1 |
Atom a = new Atom( |
49 |
|
"ATOM 349 NE2 GLN A 48 22.290 8.595 17.680 1.00 14.30 N"); |
50 |
1 |
assertEquals(349, a.atomIndex); |
51 |
1 |
assertEquals("NE", a.name); |
52 |
1 |
assertEquals("GLN", a.resName); |
53 |
1 |
assertEquals("A", a.chain); |
54 |
1 |
assertEquals(48, a.resNumber); |
55 |
1 |
assertEquals("48", a.resNumIns); |
56 |
1 |
assertEquals(' ', a.insCode); |
57 |
1 |
assertEquals(22.290, a.x, 0.00001); |
58 |
1 |
assertEquals(8.595, a.y, 0.00001); |
59 |
1 |
assertEquals(17.680, a.z, 0.00001); |
60 |
1 |
assertEquals(1f, a.occupancy, 0.00001); |
61 |
1 |
assertEquals(14.3, a.tfactor, 0.00001); |
62 |
|
} |
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
68 |
1 |
@Test(groups = { "Functional" })... |
69 |
|
public void testStringConstructor_blankOccupancyTempFactor() |
70 |
|
{ |
71 |
1 |
Atom a = new Atom( |
72 |
|
"ATOM 349 NE2 GLN A 48 22.290 8.595 17.680 N"); |
73 |
1 |
assertEquals(1f, a.occupancy, 0.00001); |
74 |
1 |
assertEquals(1f, a.tfactor, 0.00001); |
75 |
|
} |
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
1PASS
|
|
80 |
1 |
@Test(groups = { "Functional" })... |
81 |
|
public void testStringConstructor_malformed() |
82 |
|
{ |
83 |
1 |
try |
84 |
|
{ |
85 |
1 |
new Atom( |
86 |
|
"ATOM 34N NE2 GLN A 48 22.290 8.595 17.680 1.00 14.30 N"); |
87 |
0 |
Assert.fail("Expected exception"); |
88 |
|
} catch (NumberFormatException e) |
89 |
|
{ |
90 |
|
|
91 |
|
} |
92 |
|
} |
93 |
|
} |