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