*/
package jalview.ws;
+import static org.testng.Assert.assertEquals;
import static org.testng.AssertJUnit.assertTrue;
import jalview.bin.Cache;
import jalview.structure.StructureImportSettings.StructureParser;
import jalview.ws.seqfetcher.DbSourceProxy;
+import java.util.Arrays;
import java.util.List;
import org.testng.annotations.BeforeClass;
testRetrieveProteinSeqFromPDB();
}
+ private class TestRetrieveObject
+ {
+ String id;
+
+ int expectedHeight;
+
+ public TestRetrieveObject(String id, int expectedHeight)
+ {
+ super();
+ this.id = id;
+ this.expectedHeight = expectedHeight;
+ }
+
+ }
+
+ private List<TestRetrieveObject> toRetrieve = Arrays.asList(
+ new TestRetrieveObject("1QIP", 4),
+ new TestRetrieveObject("4IM2", 1));
+
private void testRetrieveProteinSeqFromPDB() throws Exception
{
List<DbSourceProxy> 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());
+ }
}
}
-
}