3 import static org.testng.AssertJUnit.assertEquals;
5 import org.testng.Assert;
6 import org.testng.annotations.Test;
12 * Test the constructor that parses a PDB file format ATOM line. Fields are in
13 * fixed column positions
15 @Test(groups ={ "Functional" })
16 public void testStringConstructor()
19 "ATOM 349 NE2 GLN A 48 22.290 8.595 17.680 1.00 14.30 N");
20 assertEquals(349, a.atomIndex);
21 assertEquals("NE", a.name);
22 assertEquals("GLN", a.resName);
23 assertEquals("A", a.chain);
24 assertEquals(48, a.resNumber);
25 assertEquals(" 48 ", a.resNumIns);
26 assertEquals(' ', a.insCode);
27 assertEquals(22.290, a.x, 0.00001);
28 assertEquals(8.595, a.y, 0.00001);
29 assertEquals(17.680, a.z, 0.00001);
30 assertEquals(1f, a.occupancy, 0.00001);
31 assertEquals(14.3, a.tfactor, 0.00001);
35 * Test the case where occupancy and temp factor are blank - should default to
38 @Test(groups ={ "Functional" })
39 public void testStringConstructor_blankOccupancyTempFactor()
42 "ATOM 349 NE2 GLN A 48 22.290 8.595 17.680 N");
43 assertEquals(1f, a.occupancy, 0.00001);
44 assertEquals(1f, a.tfactor, 0.00001);
48 * Parsing non-numeric data as Atom throws an exception
50 @Test(groups ={ "Functional" })
51 public void testStringConstructor_malformed()
56 "ATOM 34N NE2 GLN A 48 22.290 8.595 17.680 1.00 14.30 N");
57 Assert.fail("Expected exception");
58 } catch (NumberFormatException e)