From 470bdf4991a8cb9d47f2bc572a2bc13b09f7565a Mon Sep 17 00:00:00 2001 From: gmungoc Date: Wed, 7 Oct 2015 14:54:05 +0100 Subject: [PATCH] JAL-1499 test code refactor / tidy --- test/jalview/io/MegaFileTest.java | 66 +++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 36 deletions(-) diff --git a/test/jalview/io/MegaFileTest.java b/test/jalview/io/MegaFileTest.java index 1f8e4d6..881c47b 100644 --- a/test/jalview/io/MegaFileTest.java +++ b/test/jalview/io/MegaFileTest.java @@ -666,42 +666,36 @@ public class MegaFileTest // (Domain before Gene when they end together) assertEquals(9, sfs.length); // TODO settle which way round type/description go! - assertEquals("Exon1 (Adh Coding)", sfs[0].type); - assertEquals("Domain", sfs[0].description); - assertEquals(7, sfs[0].begin); - assertEquals(12, sfs[0].end); - assertEquals("Intron1 (Adh Noncoding)", sfs[1].type); - assertEquals("Domain", sfs[1].description); - assertEquals(13, sfs[1].begin); - assertEquals(18, sfs[1].end); - assertEquals("Exon2 (Adh Coding)", sfs[2].type); - assertEquals("Domain", sfs[2].description); - assertEquals(19, sfs[2].begin); - assertEquals(24, sfs[2].end); - assertEquals("Adh", sfs[3].type); - assertEquals("Gene", sfs[3].description); - assertEquals(7, sfs[3].begin); - assertEquals(24, sfs[3].end); - assertEquals("Intron1 (Opsin Noncoding)", sfs[4].type); - assertEquals("Domain", sfs[4].description); - assertEquals(25, sfs[4].begin); - assertEquals(30, sfs[4].end); - assertEquals("Opsin", sfs[5].type); - assertEquals("Gene", sfs[5].description); - assertEquals(25, sfs[5].begin); - assertEquals(30, sfs[5].end); - assertEquals("Exon1 (MEF2A Coding)", sfs[6].type); - assertEquals("Domain", sfs[6].description); - assertEquals(31, sfs[6].begin); - assertEquals(36, sfs[6].end); - assertEquals("MEF2A", sfs[7].type); - assertEquals("Gene", sfs[7].description); - assertEquals(31, sfs[7].begin); - assertEquals(36, sfs[7].end); - assertEquals("BindingSite", sfs[8].type); - assertEquals("Domain", sfs[8].description); - assertEquals(37, sfs[8].begin); - assertEquals(42, sfs[8].end); + verifySequenceFeature(sfs[0], "Exon1 (Adh Coding)", "Domain", 7, 12); + verifySequenceFeature(sfs[1], "Intron1 (Adh Noncoding)", "Domain", + 13, 18); + verifySequenceFeature(sfs[2], "Exon2 (Adh Coding)", "Domain", 19, 24); + verifySequenceFeature(sfs[3], "Adh", "Gene", 7, 24); + verifySequenceFeature(sfs[4], "Intron1 (Opsin Noncoding)", "Domain", + 25, 30); + verifySequenceFeature(sfs[5], "Opsin", "Gene", 25, 30); + verifySequenceFeature(sfs[6], "Exon1 (MEF2A Coding)", "Domain", 31, + 36); + verifySequenceFeature(sfs[7], "MEF2A", "Gene", 31, 36); + verifySequenceFeature(sfs[8], "BindingSite", "Domain", 37, 42); } } + + /** + * Helper method to assert properties of a SequenceFeature + * + * @param sf + * @param description + * @param type + * @param begin + * @param end + */ + protected void verifySequenceFeature(SequenceFeature sf, + String description, String type, int begin, int end) + { + assertEquals(description, sf.type); + assertEquals(type, sf.description); + assertEquals(begin, sf.begin); + assertEquals(end, sf.end); + } } -- 1.7.10.2