1 package jalview.structure;
3 import static org.testng.Assert.assertEquals;
4 import static org.testng.Assert.assertNull;
5 import static org.testng.Assert.fail;
7 import org.testng.annotations.Test;
9 public class AtomSpecTest
12 public void testFromChimeraAtomSpec()
14 AtomSpec as = AtomSpec.fromChimeraAtomspec("#1:12.B");
15 assertEquals(as.getModelNumber(), 1);
16 assertEquals(as.getPdbResNum(), 12);
17 assertEquals(as.getChain(), "B");
18 assertNull(as.getPdbFile());
20 // no model - default to zero
21 as = AtomSpec.fromChimeraAtomspec(":13.C");
22 assertEquals(as.getModelNumber(), 0);
23 assertEquals(as.getPdbResNum(), 13);
24 assertEquals(as.getChain(), "C");
25 assertNull(as.getPdbFile());
28 as = AtomSpec.fromChimeraAtomspec("#3.2:15");
29 assertEquals(as.getModelNumber(), 3);
30 assertEquals(as.getPdbResNum(), 15);
31 assertEquals(as.getChain(), "");
32 assertNull(as.getPdbFile());
34 String spec = "3:12.B";
37 as = AtomSpec.fromChimeraAtomspec(spec);
38 fail("Expected exception for " + spec);
39 } catch (IllegalArgumentException e)
47 as = AtomSpec.fromChimeraAtomspec(spec);
48 fail("Expected exception for " + spec);
49 } catch (IllegalArgumentException e)
57 as = AtomSpec.fromChimeraAtomspec(spec);
58 fail("Expected exception for " + spec);
59 } catch (IllegalArgumentException e)
67 as = AtomSpec.fromChimeraAtomspec(spec);
68 fail("Expected exception for " + spec);
69 } catch (NullPointerException e)