X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=test%2Fjalview%2Fws%2FSequenceFetcherTest.java;h=c643d6baa88f457e26b3f4c4d0c9870042d74ded;hb=f41806761ec9086c852941a7f91c890190fb522a;hp=76ca69b7067d76003aff370eaab4ad12ee75f602;hpb=438af5436afff7bc1ce5ab380ec5813a7beb11b9;p=jalview.git
diff --git a/test/jalview/ws/SequenceFetcherTest.java b/test/jalview/ws/SequenceFetcherTest.java
index 76ca69b..c643d6b 100644
--- a/test/jalview/ws/SequenceFetcherTest.java
+++ b/test/jalview/ws/SequenceFetcherTest.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.ws;
import jalview.analysis.CrossRef;
@@ -5,47 +25,83 @@ import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.DBRefSource;
import jalview.datamodel.SequenceI;
+import jalview.gui.JvOptionPane;
import jalview.ws.seqfetcher.ASequenceFetcher;
import jalview.ws.seqfetcher.DbSourceProxy;
import java.util.Enumeration;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Vector;
+import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
public class SequenceFetcherTest
{
+ @BeforeClass(alwaysRun = true)
+ public void setUpJvOptionPane()
+ {
+ JvOptionPane.setInteractiveMode(false);
+ JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+ }
+
+ @Test(groups = "Functional")
+ public void testNoDuplicatesInFetchDbRefs()
+ {
+ Map> seen = new HashMap<>();
+ jalview.ws.SequenceFetcher sfetcher = new jalview.ws.SequenceFetcher();
+ String dupes = "";
+ // for (String src : sfetcher.getOrderedSupportedSources())
+ for (String src : sfetcher.getNonAlignmentSources())
+ {
+ List seenitem = seen.get(src);
+ if (seenitem != null)
+ {
+ dupes += (dupes.length() > 0 ? "," : "") + src;
+ }
+ else
+ {
+ seen.put(src, sfetcher.getSourceProxy(src));
+ }
+ }
+ if (dupes.length() > 0)
+ {
+ Assert.fail("Duplicate sources : " + dupes);
+ }
+ }
+
/**
* simple run method to test dbsources.
*
* @param argv
+ * @j2sIgnore
*/
public static void main(String[] argv)
{
- // TODO: extracted from SequenceFetcher - convert to proper unit test with
+ // TODO: extracted from SequenceFetcher - convert to network dependent
+ // functional integration test with
// assertions
- AlignmentI ds = null;
- Vector