X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fws%2Fsifts%2FSiftsClientTest.java;h=6a1fa1fc8ffb269b99c2adea24e28fce9ede2d45;hb=42ca4613b0a07bab7c27a61b11acafdc9a3c27d1;hp=d805e4739dd96e3e461765bf79fb913fa9b5e9f6;hpb=f1ad88cc8d9b26244086e5c24b73fb80b0ff0a38;p=jalview.git diff --git a/test/jalview/ws/sifts/SiftsClientTest.java b/test/jalview/ws/sifts/SiftsClientTest.java index d805e47..6a1fa1f 100644 --- a/test/jalview/ws/sifts/SiftsClientTest.java +++ b/test/jalview/ws/sifts/SiftsClientTest.java @@ -32,11 +32,13 @@ import jalview.datamodel.SequenceI; import jalview.gui.JvOptionPane; import jalview.io.DataSourceType; import jalview.structure.StructureMapping; +import jalview.structure.StructureMappingClient.StructureMappingException; import jalview.xml.binding.sifts.Entry.Entity; import java.io.File; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import org.testng.Assert; @@ -280,7 +282,16 @@ public class SiftsClientTest "A", testSeq, null); Assert.assertEquals(testSeq.getStart(), 1); Assert.assertEquals(testSeq.getEnd(), 147); - Assert.assertEquals(actualMapping, expectedMapping); + // Assert.assertEquals(actualMapping, expectedMapping); + Assert.assertEquals(actualMapping.size(), expectedMapping.size()); + // Test key set + Assert.assertEquals(actualMapping.keySet(), expectedMapping.keySet()); + // Test entry set + for (int key : expectedMapping.keySet()) + { + Assert.assertTrue(Arrays.equals(expectedMapping.get(key), + actualMapping.get(key))); + } } catch (Exception e) { e.printStackTrace(); @@ -318,18 +329,18 @@ public class SiftsClientTest @Test( groups = { "Network" }, - expectedExceptions = SiftsException.class) + expectedExceptions = StructureMappingException.class) private void populateAtomPositionsNullTest1() - throws IllegalArgumentException, SiftsException + throws IllegalArgumentException, StructureMappingException { siftsClient.populateAtomPositions(null, null); } @Test( groups = { "Network" }, - expectedExceptions = SiftsException.class) + expectedExceptions = StructureMappingException.class) private void populateAtomPositionsNullTest2() - throws IllegalArgumentException, SiftsException + throws IllegalArgumentException, StructureMappingException { siftsClient.populateAtomPositions("A", null); } @@ -378,10 +389,11 @@ groups = { "Network" }, } @Test(groups = { "Network" }) - public void getSiftsStructureMappingTest() throws SiftsException + public void getSiftsStructureMappingTest() + throws StructureMappingException, Exception { Assert.assertTrue(SiftsSettings.isMapWithSifts()); - StructureMapping strucMapping = siftsClient.getSiftsStructureMapping( + StructureMapping strucMapping = siftsClient.getStructureMapping( testSeq, testPDBId, "A"); String expectedMappingOutput = "\nSequence ⟷ Structure mapping details\n" + "Method: SIFTS\n\n" @@ -399,7 +411,19 @@ groups = { "Network" }, Assert.assertEquals(strucMapping.getMappingDetailsOutput(), expectedMappingOutput); - Assert.assertEquals(strucMapping.getMapping(), expectedMapping); + + // Assert.assertEquals(strucMapping.getMapping(), expectedMapping); + Assert.assertEquals(strucMapping.getMapping().size(), + expectedMapping.size()); + // Test key set + Assert.assertEquals(strucMapping.getMapping().keySet(), + expectedMapping.keySet()); + // Test entry set + for (int key : expectedMapping.keySet()) + { + Assert.assertTrue(Arrays.equals(expectedMapping.get(key), + strucMapping.getMapping().get(key))); + } } @Test(groups = { "Network" })