JAL-2680 clear down all mappings before test
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 21 Aug 2017 14:20:36 +0000 (15:20 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 21 Aug 2017 14:20:36 +0000 (15:20 +0100)
test/jalview/gui/AlignViewportTest.java

index b2286e0..812fd8f 100644 (file)
@@ -75,6 +75,13 @@ public class AlignViewportTest
   {
     Jalview.main(new String[] { "-nonews", "-props",
         "test/jalview/testProps.jvprops" });
+
+    /*
+     * remove any sequence mappings left lying around by other tests
+     */
+    StructureSelectionManager ssm = StructureSelectionManager
+            .getStructureSelectionManager(Desktop.instance);
+    ssm.resetAll();
   }
 
   @BeforeMethod(alwaysRun = true)
@@ -173,18 +180,19 @@ public class AlignViewportTest
      */
     StructureSelectionManager ssm = StructureSelectionManager
             .getStructureSelectionManager(Desktop.instance);
-    assertEquals(2, ssm.getSequenceMappings().size());
-    assertTrue(ssm.getSequenceMappings().contains(acf1));
-    assertTrue(ssm.getSequenceMappings().contains(acf2));
+    List<AlignedCodonFrame> sequenceMappings = ssm.getSequenceMappings();
+    assertEquals(2, sequenceMappings.size());
+    assertTrue(sequenceMappings.contains(acf1));
+    assertTrue(sequenceMappings.contains(acf2));
 
     /*
      * Close the second view. Verify that mappings are not removed as the first
      * view still holds a reference to them.
      */
     af1.closeMenuItem_actionPerformed(false);
-    assertEquals(2, ssm.getSequenceMappings().size());
-    assertTrue(ssm.getSequenceMappings().contains(acf1));
-    assertTrue(ssm.getSequenceMappings().contains(acf2));
+    assertEquals(2, sequenceMappings.size());
+    assertTrue(sequenceMappings.contains(acf1));
+    assertTrue(sequenceMappings.contains(acf2));
   }
 
   /**