X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=test%2Fjalview%2Fworkers%2FAlignCalcManagerTest.java;h=a523f386e1e9de35da93e3cbcc82d39205436a95;hb=4d5f77436c8d77a776ca7c042611f36238c97057;hp=735c75d43b9fb735e3bedcf9308f3abf8f3266ae;hpb=f8e603128476ca6e093ea2fc65435d1294978c53;p=jalview.git
diff --git a/test/jalview/workers/AlignCalcManagerTest.java b/test/jalview/workers/AlignCalcManagerTest.java
index 735c75d..a523f38 100644
--- a/test/jalview/workers/AlignCalcManagerTest.java
+++ b/test/jalview/workers/AlignCalcManagerTest.java
@@ -1,3 +1,23 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.workers;
import static org.testng.AssertJUnit.assertEquals;
@@ -14,15 +34,25 @@ import jalview.datamodel.Annotation;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
+import jalview.gui.JvOptionPane;
import java.util.Collections;
import java.util.List;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class AlignCalcManagerTest
{
+
+ @BeforeClass(alwaysRun = true)
+ public void setUpJvOptionPane()
+ {
+ JvOptionPane.setInteractiveMode(false);
+ JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+ }
+
private AlignFrame alignFrame;
/**
@@ -34,11 +64,9 @@ public class AlignCalcManagerTest
public void testRemoveWorkerForAnnotation()
{
AlignCalcManagerI acm = alignFrame.getViewport().getCalcManager();
- final AlignmentAnnotation ann1 = new AlignmentAnnotation("Ann1",
- "desc",
+ final AlignmentAnnotation ann1 = new AlignmentAnnotation("Ann1", "desc",
new Annotation[] {});
- final AlignmentAnnotation ann2 = new AlignmentAnnotation("Ann2",
- "desc",
+ final AlignmentAnnotation ann2 = new AlignmentAnnotation("Ann2", "desc",
new Annotation[] {});
/*
@@ -68,7 +96,8 @@ public class AlignCalcManagerTest
}
}
- List workers = acm.getRegisteredWorkersOfClass(worker1.getClass());
+ List workers = acm
+ .getRegisteredWorkersOfClass(worker1.getClass());
assertEquals(2, workers.size());
assertTrue(workers.contains(worker1));
assertTrue(workers.contains(worker2));
@@ -91,8 +120,8 @@ public class AlignCalcManagerTest
* - should delete worker1 but not worker2
*/
acm.removeWorkerForAnnotation(ann1);
- assertEquals(1, acm.getRegisteredWorkersOfClass(worker1.getClass())
- .size());
+ assertEquals(1,
+ acm.getRegisteredWorkersOfClass(worker1.getClass()).size());
assertTrue(acm.getRegisteredWorkersOfClass(worker1.getClass())
.contains(worker2));
assertFalse(acm.isDisabled(worker1));
@@ -119,8 +148,7 @@ public class AlignCalcManagerTest
}
};
return new AnnotationWorker(alignFrame.getViewport(),
- alignFrame.alignPanel,
- annotationProvider)
+ alignFrame.alignPanel, annotationProvider)
{
@Override
public boolean isDeletable()
@@ -139,8 +167,9 @@ public class AlignCalcManagerTest
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- AlignmentI al = new Alignment(new SequenceI[] { new Sequence("Seq1",
- "ABC") });
+ AlignmentI al = new Alignment(
+ new SequenceI[]
+ { new Sequence("Seq1", "ABC") });
al.setDataset(null);
alignFrame = new AlignFrame(al, 3, 1);
}