+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.ext.ensembl;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertSame;
import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
import jalview.datamodel.Alignment;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
-import jalview.io.AppletFormatAdapter;
+import jalview.datamodel.features.SequenceFeatures;
+import jalview.gui.JvOptionPane;
+import jalview.io.DataSourceType;
import jalview.io.FastaFile;
import jalview.io.FileParse;
import jalview.io.gff.SequenceOntologyFactory;
import java.lang.reflect.Method;
import java.util.Arrays;
+import java.util.List;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
public class EnsemblSeqProxyTest
{
+
+ @BeforeClass(alwaysRun = true)
+ public void setUpJvOptionPane()
+ {
+ JvOptionPane.setInteractiveMode(false);
+ JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+ }
+
private static final Object[][] allSeqs = new Object[][] {
{
new EnsemblProtein(),
FileParse fp = proxy.getSequenceReader(Arrays
.asList(new String[] { sq }));
SequenceI[] sqs = new FastaFile(fp).getSeqsAsArray();
- FastaFile trueRes = new FastaFile(fastasq, AppletFormatAdapter.PASTE);
+ FastaFile trueRes = new FastaFile(fastasq, DataSourceType.PASTE);
SequenceI[] trueSqs = trueRes.getSeqsAsArray();
Assert.assertEquals(sqs.length, trueSqs.length,
"Different number of sequences retrieved for query " + sq);
SequenceFeature sf2 = new SequenceFeature("", "", 8, 12, 0f, null);
SequenceFeature sf3 = new SequenceFeature("", "", 8, 13, 0f, null);
SequenceFeature sf4 = new SequenceFeature("", "", 11, 11, 0f, null);
- SequenceFeature[] sfs = new SequenceFeature[] { sf1, sf2, sf3, sf4 };
+ List<SequenceFeature> sfs = Arrays.asList(new SequenceFeature[] { sf1,
+ sf2, sf3, sf4 });
// sort by start position ascending (forward strand)
// sf2 and sf3 tie and should not be reordered by sorting
- EnsemblSeqProxy.sortFeatures(sfs, true);
- assertArrayEquals(new SequenceFeature[] { sf2, sf3, sf1, sf4 }, sfs);
+ SequenceFeatures.sortFeatures(sfs, true);
+ assertSame(sfs.get(0), sf2);
+ assertSame(sfs.get(1), sf3);
+ assertSame(sfs.get(2), sf1);
+ assertSame(sfs.get(3), sf4);
// sort by end position descending (reverse strand)
- EnsemblSeqProxy.sortFeatures(sfs, false);
- assertArrayEquals(new SequenceFeature[] { sf1, sf3, sf2, sf4 }, sfs);
+ SequenceFeatures.sortFeatures(sfs, false);
+ assertSame(sfs.get(0), sf1);
+ assertSame(sfs.get(1), sf3);
+ assertSame(sfs.get(2), sf2);
+ assertSame(sfs.get(3), sf4);
}
-}
\ No newline at end of file
+}