JAL-1803 tests added for PDBEntry.Type
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 13 Sep 2016 14:51:58 +0000 (15:51 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 13 Sep 2016 14:51:58 +0000 (15:51 +0100)
test/jalview/datamodel/PDBEntryTest.java

index 1195393..cf944b2 100644 (file)
@@ -23,7 +23,10 @@ package jalview.datamodel;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertNotEquals;
+import static org.testng.Assert.assertNotSame;
 import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertSame;
+import static org.testng.Assert.assertTrue;
 
 //import org.testng.Assert;
 import org.testng.annotations.AfterMethod;
@@ -100,4 +103,23 @@ public class PDBEntryTest
     pdbEntry.setChainCode(null);
     assertNull(pdbEntry.getChainCode());
   }
+
+  @Test(groups = { "Functional" })
+  public void testGetType()
+  {
+    assertSame(PDBEntry.Type.FILE, PDBEntry.Type.getType("FILE"));
+    assertSame(PDBEntry.Type.FILE, PDBEntry.Type.getType("File"));
+    assertSame(PDBEntry.Type.FILE, PDBEntry.Type.getType("file"));
+    assertNotSame(PDBEntry.Type.FILE, PDBEntry.Type.getType("file "));
+  }
+
+  @Test(groups = { "Functional" })
+  public void testTypeMatches()
+  {
+    // TODO Type.matches() is not used - delete?
+    assertTrue(PDBEntry.Type.FILE.matches("FILE"));
+    assertTrue(PDBEntry.Type.FILE.matches("File"));
+    assertTrue(PDBEntry.Type.FILE.matches("file"));
+    assertFalse(PDBEntry.Type.FILE.matches("FILE "));
+  }
 }