From: Jim Procter Date: Wed, 18 Oct 2017 14:14:46 +0000 (+0100) Subject: JAL-2780 JAL-2781 refactored PDB fetch network tests to add in 4IM2 - this test now... X-Git-Tag: Release_2_10_4~68^2~45 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=a47d3497273497061faecb889117682d09339675;p=jalview.git JAL-2780 JAL-2781 refactored PDB fetch network tests to add in 4IM2 - this test now fails due to JAL-2780 and JAL-2781. Also note JAL-2224 - the test relies on SequenceI.getEnd()-SequenceI.getStart()+1 == length, which fails for these two test cases. --- diff --git a/test/jalview/ws/PDBSequenceFetcherTest.java b/test/jalview/ws/PDBSequenceFetcherTest.java index 95863e7..0572c85 100644 --- a/test/jalview/ws/PDBSequenceFetcherTest.java +++ b/test/jalview/ws/PDBSequenceFetcherTest.java @@ -20,6 +20,7 @@ */ package jalview.ws; +import static org.testng.Assert.assertEquals; import static org.testng.AssertJUnit.assertTrue; import jalview.bin.Cache; @@ -30,6 +31,7 @@ import jalview.structure.StructureImportSettings; import jalview.structure.StructureImportSettings.StructureParser; import jalview.ws.seqfetcher.DbSourceProxy; +import java.util.Arrays; import java.util.List; import org.testng.annotations.BeforeClass; @@ -106,23 +108,45 @@ public class PDBSequenceFetcherTest testRetrieveProteinSeqFromPDB(); } + private class TestRetrieveObject + { + String id; + + int expectedHeight; + + public TestRetrieveObject(String id, int expectedHeight) + { + super(); + this.id = id; + this.expectedHeight = expectedHeight; + } + + } + + private List toRetrieve = Arrays.asList( + new TestRetrieveObject("1QIP", 4), + new TestRetrieveObject("4IM2", 1)); + private void testRetrieveProteinSeqFromPDB() throws Exception { List sps = sf.getSourceProxy("PDB"); - AlignmentI response = sps.get(0).getSequenceRecords("1QIP"); - assertTrue(response != null); - assertTrue(response.getHeight() == 4); - for (SequenceI sq : response.getSequences()) + for (TestRetrieveObject str : toRetrieve) { - assertTrue("No annotation transfered to sequence.", - sq.getAnnotation().length > 0); - assertTrue("No PDBEntry on sequence.", - sq.getAllPDBEntries().size() > 0); - org.testng.Assert - .assertEquals(sq.getEnd() - sq.getStart() + 1, - sq.getLength(), - "Sequence start/end doesn't match number of residues in sequence"); + AlignmentI response = sps.get(0).getSequenceRecords(str.id); + assertTrue("No aligment for " + str.id, response != null); + assertEquals(response.getHeight(), str.expectedHeight, + "Number of chains for " + str.id); + for (SequenceI sq : response.getSequences()) + { + assertTrue("No annotation transfered to sequence " + sq.getName(), + sq.getAnnotation().length > 0); + assertTrue("No PDBEntry on sequence " + sq.getName(), + sq.getAllPDBEntries().size() > 0); + org.testng.Assert.assertEquals(sq.getEnd() - sq.getStart() + 1, + sq.getLength(), + "Sequence start/end doesn't match number of residues in sequence for " + + sq.getName()); + } } } - }