JAL-2312 unit test for bug fix - repeated mapping generated from SIFTS when heuristic...
[jalview.git] / test / jalview / ws / sifts / SiftsClientTest.java
index 8d26c45..f22a3b7 100644 (file)
@@ -449,7 +449,7 @@ public class SiftsClientTest
   }
 
   @Test(groups = { "Functional" })
-  public void getEntityByMostOptimalMatchedIdTest()
+  public void getEntityByMostOptimalMatchedIdTest1()
   {
     SiftsClient siftsClientX = null;
     PDBfile pdbFile;
@@ -472,4 +472,34 @@ public class SiftsClientTest
     Assert.assertEquals(entityD.getEntityId(), "D");
 
   }
+
+  @Test(groups = { "Functional" })
+  public void getEntityByMostOptimalMatchedIdTest2()
+  {
+    // This test is for a SIFTS file in which entity A should map to chain P for
+    // the given PDB Id. All the other chains shouldn't be mapped as there are
+    // no SIFTS entity records for them.
+    SiftsClient siftsClientX = null;
+    PDBfile pdbFile;
+    try
+    {
+      pdbFile = new PDBfile(false, false, false,
+              "test/jalview/io/3ucu.cif", AppletFormatAdapter.FILE);
+      siftsClientX = new SiftsClient(pdbFile);
+    } catch (Exception e)
+    {
+      e.printStackTrace();
+    }
+    Entity entityA = siftsClientX.getEntityByMostOptimalMatchedId("P");
+    Entity entityP = siftsClientX.getEntityByMostOptimalMatchedId("A");
+    Entity entityR = siftsClientX.getEntityByMostOptimalMatchedId("R");
+    Assert.assertEquals(entityA.getEntityId(), "A");
+    Assert.assertNotEquals(entityR, "A");
+    Assert.assertNotEquals(entityP, "A");
+    Assert.assertNotEquals(entityR, "R");
+    Assert.assertNotEquals(entityP, "P");
+    Assert.assertNull(entityR);
+    Assert.assertNull(entityP);
+
+  }
 }