From cfa118f7383e300235afb04ec0e093bf4e50b928 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Tue, 26 Mar 2019 15:18:48 +0000 Subject: [PATCH] JAL-3026 reinstate test to classpath, fix compilation errors therein --- .classpath | 2 +- test/jalview/ext/ensembl/EnsemblXrefTest.java | 17 +++++++++-------- test/jalview/util/JSONUtilsTest.java | 8 ++++---- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.classpath b/.classpath index 1cca7ba..bd4f831 100644 --- a/.classpath +++ b/.classpath @@ -1,7 +1,7 @@ - + diff --git a/test/jalview/ext/ensembl/EnsemblXrefTest.java b/test/jalview/ext/ensembl/EnsemblXrefTest.java index 9cc6627..07f8892 100644 --- a/test/jalview/ext/ensembl/EnsemblXrefTest.java +++ b/test/jalview/ext/ensembl/EnsemblXrefTest.java @@ -25,13 +25,13 @@ import static org.testng.AssertJUnit.assertFalse; import jalview.datamodel.DBRefEntry; import jalview.gui.JvOptionPane; +import jalview.util.JSONUtils; -import java.io.BufferedReader; import java.io.IOException; -import java.io.StringReader; import java.net.URL; import java.util.List; +import org.json.simple.parser.ParseException; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -61,12 +61,13 @@ public class EnsemblXrefTest EnsemblXref testee = new EnsemblXref("http://rest.ensembl.org", dbName, dbVers) { - @Override - protected BufferedReader getHttpResponse(URL url, List ids) - throws IOException - { - return new BufferedReader(new StringReader(JSON)); - } + @SuppressWarnings("unchecked") + @Override + protected Object getJSON(URL url, List ids, int msDelay, int mode, String mapKey) throws IOException, ParseException + { + return ((List)JSONUtils.parse(JSON)).iterator(); + } + }; // synonyms and GO terms are not returned diff --git a/test/jalview/util/JSONUtilsTest.java b/test/jalview/util/JSONUtilsTest.java index 45f1c48..d898a88 100644 --- a/test/jalview/util/JSONUtilsTest.java +++ b/test/jalview/util/JSONUtilsTest.java @@ -12,15 +12,15 @@ public class JSONUtilsTest @Test(groups = "Functional") public void testArrayToList() throws JSONException { - assertNull(JSONUtils.arrayToList(null)); + assertNull(JSONUtils.arrayToStringList(null)); JSONArray ja = new JSONArray(); - assertNull(JSONUtils.arrayToList(null)); + assertNull(JSONUtils.arrayToStringList(null)); ja.add("hello"); - assertEquals(JSONUtils.arrayToList(ja), "hello"); + assertEquals(JSONUtils.arrayToStringList(ja), "hello"); ja.add("world"); - assertEquals(JSONUtils.arrayToList(ja), "hello,world"); + assertEquals(JSONUtils.arrayToStringList(ja), "hello,world"); } } -- 1.7.10.2