From 392a64b25e64425a290d27003528ae89ad22927c Mon Sep 17 00:00:00 2001 From: Tom Morris Date: Sat, 22 Aug 2020 17:33:40 -0400 Subject: [PATCH 1/5] Refactor tests to hoist common methods into RefineTest Moves the invoke() method and the associated fields into the super class and deletes the redundant implementations. --- .../src/com/google/refine/RefineTest.java | 29 ++++++++++ .../refine/expr/functions/CoalesceTests.java | 20 ------- .../refine/expr/functions/CrossTests.java | 19 ------- .../refine/expr/functions/TypeTests.java | 20 ------- .../expr/functions/arrays/InArrayTests.java | 28 ---------- .../expr/functions/booleans/BooleanTests.java | 53 ------------------- .../expr/functions/date/DatePartTests.java | 31 ----------- .../refine/expr/functions/date/IncTests.java | 33 ------------ .../refine/expr/functions/date/NowTests.java | 33 ------------ .../expr/functions/html/ParseHtmlTests.java | 31 ----------- .../functions/math/RandomNumberTests.java | 29 ---------- .../expr/functions/strings/ContainsTests.java | 48 +---------------- .../expr/functions/strings/DiffTests.java | 31 ----------- .../expr/functions/strings/FindTests.java | 34 ------------ .../functions/strings/FingerprintTests.java | 31 ----------- .../expr/functions/strings/RangeTests.java | 35 ------------ .../expr/functions/strings/TrimTests.java | 31 ----------- .../expr/functions/xml/ParseXmlTests.java | 31 ----------- .../com/google/refine/grel/FunctionTests.java | 29 ++-------- .../importers/XmlImportUtilitiesTests.java | 1 - 20 files changed, 34 insertions(+), 563 deletions(-) diff --git a/main/tests/server/src/com/google/refine/RefineTest.java b/main/tests/server/src/com/google/refine/RefineTest.java index 7ff47a97c..22b29ec6c 100644 --- a/main/tests/server/src/com/google/refine/RefineTest.java +++ b/main/tests/server/src/com/google/refine/RefineTest.java @@ -43,6 +43,7 @@ import java.io.IOException; import java.io.StringReader; import java.util.ArrayList; import java.util.List; +import java.util.Properties; import org.apache.commons.io.FileUtils; import org.powermock.modules.testng.PowerMockTestCase; @@ -57,6 +58,8 @@ import com.fasterxml.jackson.databind.node.BooleanNode; import com.fasterxml.jackson.databind.node.IntNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.TextNode; +import com.google.refine.grel.ControlFunctionRegistry; +import com.google.refine.grel.Function; import com.google.refine.importers.SeparatorBasedImporter; import com.google.refine.importing.ImportingJob; import com.google.refine.importing.ImportingManager; @@ -75,6 +78,8 @@ import edu.mit.simile.butterfly.ButterflyModule; */ public class RefineTest extends PowerMockTestCase { + protected static Properties bindings = null; + protected Logger logger; boolean testFailed; @@ -308,6 +313,30 @@ public class RefineTest extends PowerMockTestCase { verify(options, times(1)).get(name); } + /** + * Lookup a control function by name and invoke it with a variable number of args + */ + protected static Object invoke(String name, Object... args) { + // registry uses static initializer, so no need to set it up + Function function = ControlFunctionRegistry.getFunction(name); + if (bindings == null) { + bindings = new Properties(); + } + if (function == null) { + throw new IllegalArgumentException("Unknown function "+name); + } + if (args == null) { + return function.call(bindings,new Object[0]); + } else { + return function.call(bindings,args); + } + } + + @AfterMethod + public void TearDown() throws Exception { + bindings = null; + } + protected ButterflyModule getCoreModule() { ButterflyModule coreModule = mock(ButterflyModule.class); when(coreModule.getName()).thenReturn("core"); diff --git a/main/tests/server/src/com/google/refine/expr/functions/CoalesceTests.java b/main/tests/server/src/com/google/refine/expr/functions/CoalesceTests.java index 04893f12e..f545e3d5d 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/CoalesceTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/CoalesceTests.java @@ -44,15 +44,11 @@ import org.testng.annotations.Test; import com.google.refine.RefineTest; import com.google.refine.expr.EvalError; -import com.google.refine.expr.functions.Coalesce; -import com.google.refine.grel.ControlFunctionRegistry; -import com.google.refine.grel.Function; import com.google.refine.util.TestUtils; public class CoalesceTests extends RefineTest { - private static Properties bindings; private static final Integer[] ZERO_TO_TWO = new Integer[] {0, 1, 2}; @Override @@ -71,22 +67,6 @@ public class CoalesceTests extends RefineTest { bindings = null; } - /** - * Lookup a control function by name and invoke it with a variable number of args - */ - private static Object invoke(String name,Object... args) { - // registry uses static initializer, so no need to set it up - Function function = ControlFunctionRegistry.getFunction(name); - if (function == null) { - throw new IllegalArgumentException("Unknown function "+name); - } - if (args == null) { - return function.call(bindings,new Object[0]); - } else { - return function.call(bindings,args); - } - } - @Test public void testCoalesceInvalidParams() { Assert.assertTrue(invoke("coalesce") instanceof EvalError); diff --git a/main/tests/server/src/com/google/refine/expr/functions/CrossTests.java b/main/tests/server/src/com/google/refine/expr/functions/CrossTests.java index 068cf0131..a8638e36f 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/CrossTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/CrossTests.java @@ -41,8 +41,6 @@ import com.google.refine.expr.EvalError; import com.google.refine.expr.HasFieldsListImpl; import com.google.refine.expr.WrappedCell; import com.google.refine.expr.WrappedRow; -import com.google.refine.grel.ControlFunctionRegistry; -import com.google.refine.grel.Function; import com.google.refine.model.Cell; import com.google.refine.model.Project; import com.google.refine.model.Row; @@ -52,7 +50,6 @@ import com.google.refine.util.TestUtils; * Test cases for cross function. */ public class CrossTests extends RefineTest { - static Properties bindings; private static OffsetDateTime dateTimeValue = OffsetDateTime.parse("2017-05-12T05:45:00+00:00", DateTimeFormatter.ISO_OFFSET_DATE_TIME); @Override @@ -374,22 +371,6 @@ public class CrossTests extends RefineTest { "cross expects a cell or value, a project name to look up (optional), and a column name in that project (optional)"); } - /** - * Lookup a control function by name and invoke it with a variable number of args - */ - private static Object invoke(String name,Object... args) { - // registry uses static initializer, so no need to set it up - Function function = ControlFunctionRegistry.getFunction(name); - if (function == null) { - throw new IllegalArgumentException("Unknown function "+name); - } - if (args == null) { - return function.call(bindings,new Object[0]); - } else { - return function.call(bindings,args); - } - } - @Test public void serializeCross() { String json = "{\"description\":\"Looks up the given value in the target column of the target project, returns an array of matched rows. Two values match if and only if they have the same string representation. " + diff --git a/main/tests/server/src/com/google/refine/expr/functions/TypeTests.java b/main/tests/server/src/com/google/refine/expr/functions/TypeTests.java index 4e18408ea..56b4baab7 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/TypeTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/TypeTests.java @@ -42,14 +42,10 @@ import java.util.Properties; import com.google.refine.RefineTest; import com.google.refine.expr.EvalError; -import com.google.refine.expr.functions.Type; -import com.google.refine.grel.ControlFunctionRegistry; -import com.google.refine.grel.Function; import com.google.refine.util.TestUtils; public class TypeTests extends RefineTest { - private static Properties bindings; static final List listArray = Arrays.asList("v1", "v2", "v3"); private static OffsetDateTime dateTimeValue = OffsetDateTime.parse("2017-05-12T05:45:00+00:00", DateTimeFormatter.ISO_OFFSET_DATE_TIME); @@ -69,22 +65,6 @@ public class TypeTests extends RefineTest { bindings = null; } - /** - * Lookup a control function by name and invoke it with a variable number of args - */ - private static Object invoke(String name,Object... args) { - // registry uses static initializer, so no need to set it up - Function function = ControlFunctionRegistry.getFunction(name); - if (function == null) { - throw new IllegalArgumentException("Unknown function "+name); - } - if (args == null) { - return function.call(bindings,new Object[0]); - } else { - return function.call(bindings,args); - } - } - @Test public void testTypeInvalidParams() { Assert.assertTrue(invoke("type") instanceof EvalError); diff --git a/main/tests/server/src/com/google/refine/expr/functions/arrays/InArrayTests.java b/main/tests/server/src/com/google/refine/expr/functions/arrays/InArrayTests.java index 5d3e0dcea..09e7549a6 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/arrays/InArrayTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/arrays/InArrayTests.java @@ -32,16 +32,11 @@ import java.util.List; import java.util.Properties; import org.testng.Assert; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import com.fasterxml.jackson.databind.node.ArrayNode; import com.google.refine.RefineTest; import com.google.refine.expr.EvalError; -import com.google.refine.expr.functions.arrays.InArray; -import com.google.refine.grel.ControlFunctionRegistry; -import com.google.refine.grel.Function; import com.google.refine.util.TestUtils; public class InArrayTests extends RefineTest { @@ -51,16 +46,6 @@ public class InArrayTests extends RefineTest { static final String stringArray[] = {"v1","v2","v3"}; - @BeforeMethod - public void SetUp() { - bindings = new Properties(); - } - - @AfterMethod - public void TearDown() { - bindings = null; - } - @Test public void serializeInArray() { String json = "{\"description\":\"Checks if array a contains string s\",\"params\":\"array a, string s\",\"returns\":\"boolean\"}"; @@ -93,18 +78,5 @@ public class InArrayTests extends RefineTest { Assert.assertTrue((boolean) invoke("inArray", arrayNode, "v1")); Assert.assertFalse((boolean) invoke("inArray", arrayNode, "v4")); } - - private static Object invoke(String name,Object... args) { - // registry uses static initializer, so no need to set it up - Function function = ControlFunctionRegistry.getFunction(name); - if (function == null) { - throw new IllegalArgumentException("Unknown function "+name); - } - if (args == null) { - return function.call(bindings,new Object[0]); - } else { - return function.call(bindings,args); - } - } } diff --git a/main/tests/server/src/com/google/refine/expr/functions/booleans/BooleanTests.java b/main/tests/server/src/com/google/refine/expr/functions/booleans/BooleanTests.java index 0aecb1e05..ca8d79978 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/booleans/BooleanTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/booleans/BooleanTests.java @@ -33,24 +33,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package com.google.refine.expr.functions.booleans; -import java.io.IOException; -import java.util.Properties; - import org.slf4j.LoggerFactory; import org.testng.Assert; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import com.google.refine.RefineTest; import com.google.refine.expr.EvalError; -import com.google.refine.grel.ControlFunctionRegistry; -import com.google.refine.grel.Function; -import com.google.refine.model.Cell; -import com.google.refine.model.ModelException; -import com.google.refine.model.Project; -import com.google.refine.model.Row; public class BooleanTests extends RefineTest { @@ -72,54 +61,12 @@ public class BooleanTests extends RefineTest { {"xor","false","true","false","true"}, }; - - static private Properties bindings; - private Project project; - - @Override @BeforeTest public void init() { logger = LoggerFactory.getLogger(this.getClass()); } - @BeforeMethod - public void SetUp() throws IOException, ModelException { - bindings = new Properties(); - project = createProjectWithColumns("BooleanTests", "Column A"); - - bindings.put("project", project); - - // Five rows of a's and five of 1s - for (int i = 0; i < 10; i++) { - Row row = new Row(1); - row.setCell(0, new Cell(i < 5 ? "a":new Integer(1), null)); - project.rows.add(row); - } - } - - - @AfterMethod - public void TearDown() { - bindings = null; - } - - /** - * Lookup a control function by name and invoke it with a variable number of args - */ - private static Object invoke(String name,Object... args) { - // registry uses static initializer, so no need to set it up - Function function = ControlFunctionRegistry.getFunction(name); - if (function == null) { - throw new IllegalArgumentException("Unknown function "+name); - } - if (args == null) { - return function.call(bindings,new Object[0]); - } else { - return function.call(bindings,args); - } - } - @Test public void testInvalidParams() { for (String op : new String[] {"and","or","xor"}) { diff --git a/main/tests/server/src/com/google/refine/expr/functions/date/DatePartTests.java b/main/tests/server/src/com/google/refine/expr/functions/date/DatePartTests.java index d480c38c3..5fbbd2e97 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/date/DatePartTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/date/DatePartTests.java @@ -35,15 +35,10 @@ import java.util.TimeZone; import org.slf4j.LoggerFactory; import org.testng.Assert; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import com.google.refine.RefineTest; -import com.google.refine.expr.functions.date.DatePart; -import com.google.refine.grel.ControlFunctionRegistry; -import com.google.refine.grel.Function; import com.google.refine.util.TestUtils; @@ -57,32 +52,6 @@ public class DatePartTests extends RefineTest { logger = LoggerFactory.getLogger(this.getClass()); } - @BeforeMethod - public void SetUp() { - bindings = new Properties(); - } - - @AfterMethod - public void TearDown() { - bindings = null; - } - - /** - * Lookup a control function by name and invoke it with a variable number of args - */ - private static Object invoke(String name,Object... args) { - // registry uses static initializer, so no need to set it up - Function function = ControlFunctionRegistry.getFunction(name); - if (function == null) { - throw new IllegalArgumentException("Unknown function "+name); - } - if (args == null) { - return function.call(bindings,new Object[0]); - } else { - return function.call(bindings,args); - } - } - private DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd-HH:mm:ss.SSSSSSSSSX"); @Test diff --git a/main/tests/server/src/com/google/refine/expr/functions/date/IncTests.java b/main/tests/server/src/com/google/refine/expr/functions/date/IncTests.java index a9e9a8525..81f42e71d 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/date/IncTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/date/IncTests.java @@ -29,25 +29,18 @@ package com.google.refine.expr.functions.date; import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; import java.time.temporal.ChronoUnit; -import java.util.Properties; import org.slf4j.LoggerFactory; import org.testng.Assert; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import com.google.refine.RefineTest; import com.google.refine.expr.EvalError; -import com.google.refine.expr.functions.date.Inc; -import com.google.refine.grel.ControlFunctionRegistry; -import com.google.refine.grel.Function; import com.google.refine.util.TestUtils; public class IncTests extends RefineTest { - private static Properties bindings; private DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd-HH:mm:ss.SSSSSSSSSX"); @Override @@ -55,33 +48,7 @@ public class IncTests extends RefineTest { public void init() { logger = LoggerFactory.getLogger(this.getClass()); } - - @BeforeMethod - public void setUp() { - bindings = new Properties(); - } - @AfterMethod - public void tearDown() { - bindings = null; - } - - /** - * Lookup a control function by name and invoke it with a variable number of args - */ - private static Object invoke(String name,Object... args) { - // registry uses static initializer, so no need to set it up - Function function = ControlFunctionRegistry.getFunction(name); - if (function == null) { - throw new IllegalArgumentException("Unknown function "+name); - } - if (args == null) { - return function.call(bindings,new Object[0]); - } else { - return function.call(bindings,args); - } - } - @Test public void testInc() { OffsetDateTime source = OffsetDateTime.parse("20180510-23:55:44.000789000Z", diff --git a/main/tests/server/src/com/google/refine/expr/functions/date/NowTests.java b/main/tests/server/src/com/google/refine/expr/functions/date/NowTests.java index 45ad6218a..22516d123 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/date/NowTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/date/NowTests.java @@ -28,24 +28,17 @@ package com.google.refine.expr.functions.date; import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; -import java.util.Properties; import org.slf4j.LoggerFactory; import org.testng.Assert; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import com.google.refine.RefineTest; -import com.google.refine.expr.functions.date.Now; -import com.google.refine.grel.ControlFunctionRegistry; -import com.google.refine.grel.Function; import com.google.refine.util.TestUtils; public class NowTests extends RefineTest { - private static Properties bindings; private DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd-HH:mm:ss.SSSSSSSSSX"); @Override @@ -53,33 +46,7 @@ public class NowTests extends RefineTest { public void init() { logger = LoggerFactory.getLogger(this.getClass()); } - - @BeforeMethod - public void setUp() { - bindings = new Properties(); - } - @AfterMethod - public void tearDown() { - bindings = null; - } - - /** - * Lookup a control function by name and invoke it with a variable number of args - */ - private static Object invoke(String name,Object... args) { - // registry uses static initializer, so no need to set it up - Function function = ControlFunctionRegistry.getFunction(name); - if (function == null) { - throw new IllegalArgumentException("Unknown function "+name); - } - if (args == null) { - return function.call(bindings,new Object[0]); - } else { - return function.call(bindings,args); - } - } - @Test public void testNow() { // 2018-4-30 23:55:44 diff --git a/main/tests/server/src/com/google/refine/expr/functions/html/ParseHtmlTests.java b/main/tests/server/src/com/google/refine/expr/functions/html/ParseHtmlTests.java index 7c5294f66..d81a78b39 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/html/ParseHtmlTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/html/ParseHtmlTests.java @@ -33,15 +33,10 @@ import java.util.Properties; import org.slf4j.LoggerFactory; import org.testng.Assert; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeTest; import com.google.refine.RefineTest; import com.google.refine.expr.EvalError; -import com.google.refine.expr.functions.html.ParseHtml; -import com.google.refine.grel.ControlFunctionRegistry; -import com.google.refine.grel.Function; import com.google.refine.util.TestUtils; public class ParseHtmlTests extends RefineTest { @@ -65,32 +60,6 @@ public class ParseHtmlTests extends RefineTest { logger = LoggerFactory.getLogger(this.getClass()); } - @BeforeMethod - public void SetUp() { - bindings = new Properties(); - } - - @AfterMethod - public void TearDown() { - bindings = null; - } - - /** - * Lookup a control function by name and invoke it with a variable number of args - */ - private static Object invoke(String name,Object... args) { - // registry uses static initializer, so no need to set it up - Function function = ControlFunctionRegistry.getFunction(name); - if (function == null) { - throw new IllegalArgumentException("Unknown function "+name); - } - if (args == null) { - return function.call(bindings,new Object[0]); - } else { - return function.call(bindings,args); - } - } - @Test public void serializeParseHtml() { String json = "{\"description\":\"Parses a string as HTML\",\"params\":\"string s\",\"returns\":\"HTML object\"}"; diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/RandomNumberTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/RandomNumberTests.java index 287611984..3fb5b93b3 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/RandomNumberTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/RandomNumberTests.java @@ -29,31 +29,15 @@ package com.google.refine.expr.functions.math; import java.util.Properties; import org.testng.Assert; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.RandomNumber; import com.google.refine.RefineTest; import com.google.refine.expr.EvalError; -import com.google.refine.expr.functions.arrays.InArray; -import com.google.refine.grel.ControlFunctionRegistry; -import com.google.refine.grel.Function; import com.google.refine.util.TestUtils; public class RandomNumberTests extends RefineTest { static Properties bindings; - @BeforeMethod - public void SetUp() { - bindings = new Properties(); - } - - @AfterMethod - public void TearDown() { - bindings = null; - } - @Test public void serializeRandomNumber() { String json = "{\"description\":\"Returns a pseudo-random integer between the lower and upper bound (inclusive)\",\"params\":\"number lower bound, number upper bound\",\"returns\":\"number\"}"; @@ -73,18 +57,5 @@ public class RandomNumberTests extends RefineTest { Object a = invoke("randomNumber", 1, 10); Assert.assertTrue((int) a < 11 && (int) a > 0); } - - private static Object invoke(String name,Object... args) { - // registry uses static initializer, so no need to set it up - Function function = ControlFunctionRegistry.getFunction(name); - if (function == null) { - throw new IllegalArgumentException("Unknown function "+name); - } - if (args == null) { - return function.call(bindings,new Object[0]); - } else { - return function.call(bindings,args); - } - } } diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/ContainsTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/ContainsTests.java index ea70f882a..76f288eca 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/ContainsTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/ContainsTests.java @@ -26,33 +26,20 @@ ******************************************************************************/ package com.google.refine.expr.functions.strings; -import org.testng.annotations.Test; - -import com.google.refine.expr.functions.strings.Contains; -import com.google.refine.util.TestUtils; - -import java.util.Properties; import java.util.regex.Pattern; import org.slf4j.LoggerFactory; import org.testng.Assert; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; -import com.google.refine.RefineServlet; -import com.google.refine.RefineServletStub; import com.google.refine.RefineTest; -import com.google.refine.grel.ControlFunctionRegistry; -import com.google.refine.grel.Function; +import com.google.refine.util.TestUtils; /** * Test cases for find function. */ public class ContainsTests extends RefineTest { - - static Properties bindings; @Override @BeforeTest @@ -60,21 +47,6 @@ public class ContainsTests extends RefineTest { logger = LoggerFactory.getLogger(this.getClass()); } - // dependencies - RefineServlet servlet; - - @BeforeMethod - public void SetUp() { - bindings = new Properties(); - - servlet = new RefineServletStub(); - } - - @AfterMethod - public void TearDown() { - } - - @Test public void testContainsFunction() { String value = "rose is a rose"; @@ -84,27 +56,11 @@ public class ContainsTests extends RefineTest { Assert.assertEquals(invoke("contains", value, "$"),false); Assert.assertEquals(invoke("contains", value, "r.se"),false); Assert.assertEquals(invoke("contains", value, "\\s+"),false); - // Input regex pattern in UI with : "/ /" , is intepreted as Pattern + // Input regex pattern in UI with : "/ /" , is interpreted as Pattern Assert.assertEquals(invoke("contains", value, Pattern.compile("$")),true); Assert.assertEquals(invoke("contains", value, Pattern.compile("\\s+")),true); } - /** - * Lookup a control function by name and invoke it with a variable number of args - */ - private static Object invoke(String name,Object... args) { - // registry uses static initializer, so no need to set it up - Function function = ControlFunctionRegistry.getFunction(name); - if (function == null) { - throw new IllegalArgumentException("Unknown function "+name); - } - if (args == null) { - return function.call(bindings,new Object[0]); - } else { - return function.call(bindings,args); - } - } - @Test public void serializeContains() { String json = "{\"description\":\"Returns whether s contains frag\",\"params\":\"string s, string frag\",\"returns\":\"boolean\"}"; diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/DiffTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/DiffTests.java index 37c5971ff..7e60d1034 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/DiffTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/DiffTests.java @@ -33,16 +33,11 @@ import java.util.Properties; import org.slf4j.LoggerFactory; import org.testng.Assert; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import com.google.refine.RefineTest; import com.google.refine.expr.EvalError; -import com.google.refine.expr.functions.strings.Diff; -import com.google.refine.grel.ControlFunctionRegistry; -import com.google.refine.grel.Function; import com.google.refine.util.TestUtils; @@ -73,32 +68,6 @@ public class DiffTests extends RefineTest { odt8 = OffsetDateTime.of(1923, 4, 21, 12, 0, 0, 0, ZoneOffset.UTC); } - @BeforeMethod - public void SetUp() { - bindings = new Properties(); - } - - @AfterMethod - public void TearDown() { - bindings = null; - } - - /** - * Lookup a control function by name and invoke it with a variable number of args - */ - private static Object invoke(String name,Object... args) { - // registry uses static initializer, so no need to set it up - Function function = ControlFunctionRegistry.getFunction(name); - if (function == null) { - throw new IllegalArgumentException("Unknown function "+name); - } - if (args == null) { - return function.call(bindings,new Object[0]); - } else { - return function.call(bindings,args); - } - } - @Test public void testDiffInvalidParams() { Assert.assertTrue(invoke("diff") instanceof EvalError); diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/FindTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/FindTests.java index 530fffa25..06ca39da4 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/FindTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/FindTests.java @@ -31,17 +31,11 @@ import java.util.regex.Pattern; import org.slf4j.LoggerFactory; import org.testng.Assert; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import com.google.refine.RefineServlet; -import com.google.refine.RefineServletStub; import com.google.refine.RefineTest; -import com.google.refine.expr.functions.strings.Find; -import com.google.refine.grel.ControlFunctionRegistry; -import com.google.refine.grel.Function; import com.google.refine.util.TestUtils; /** @@ -59,18 +53,6 @@ public class FindTests extends RefineTest { // dependencies RefineServlet servlet; - @BeforeMethod - public void SetUp() { - bindings = new Properties(); - - servlet = new RefineServletStub(); - } - - @AfterMethod - public void TearDown() { - } - - @Test public void findFunctionFindAllTest() throws Exception { String[] matches = (String[]) invoke("find", "This is a test string for testing find.", "test"); @@ -96,20 +78,4 @@ public class FindTests extends RefineTest { String json = "{\"description\":\"Returns all the occurances of match given regular expression\",\"params\":\"string or regexp\",\"returns\":\"array of strings\"}"; TestUtils.isSerializedTo(new Find(), json); } - - /** - * Lookup a control function by name and invoke it with a variable number of args - */ - private static Object invoke(String name,Object... args) { - // registry uses static initializer, so no need to set it up - Function function = ControlFunctionRegistry.getFunction(name); - if (function == null) { - throw new IllegalArgumentException("Unknown function "+name); - } - if (args == null) { - return function.call(bindings,new Object[0]); - } else { - return function.call(bindings,args); - } - } } diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/FingerprintTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/FingerprintTests.java index 8fdd2aeed..66138c9a8 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/FingerprintTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/FingerprintTests.java @@ -35,15 +35,10 @@ import java.util.Properties; import org.slf4j.LoggerFactory; import org.testng.Assert; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import com.google.refine.RefineTest; -import com.google.refine.expr.functions.strings.Fingerprint; -import com.google.refine.grel.ControlFunctionRegistry; -import com.google.refine.grel.Function; import com.google.refine.util.TestUtils; @@ -71,32 +66,6 @@ public class FingerprintTests extends RefineTest { logger = LoggerFactory.getLogger(this.getClass()); } - @BeforeMethod - public void SetUp() { - bindings = new Properties(); - } - - @AfterMethod - public void TearDown() { - bindings = null; - } - - /** - * Lookup a control function by name and invoke it with a variable number of args - */ - private static Object invoke(String name,Object... args) { - // registry uses static initializer, so no need to set it up - Function function = ControlFunctionRegistry.getFunction(name); - if (function == null) { - throw new IllegalArgumentException("Unknown function "+name); - } - if (args == null) { - return function.call(bindings,new Object[0]); - } else { - return function.call(bindings,args); - } - } - @Test public void testInvalidParams() { Assert.assertNull(invoke("fingerprint")); diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/RangeTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/RangeTests.java index 7f770ce3a..71ead4605 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/RangeTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/RangeTests.java @@ -26,20 +26,13 @@ ******************************************************************************/ package com.google.refine.expr.functions.strings; -import java.util.Properties; - import org.slf4j.LoggerFactory; import org.testng.Assert; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import com.google.refine.RefineTest; import com.google.refine.expr.EvalError; -import com.google.refine.expr.functions.strings.Range; -import com.google.refine.grel.ControlFunctionRegistry; -import com.google.refine.grel.Function; import com.google.refine.util.TestUtils; /** @@ -47,8 +40,6 @@ import com.google.refine.util.TestUtils; */ public class RangeTests extends RefineTest { - private static Properties bindings; - private static final Integer[] EMPTY_ARRAY = new Integer[0]; private static final Integer[] ONE_AND_THREE = new Integer[] {1, 3}; @@ -67,32 +58,6 @@ public class RangeTests extends RefineTest { logger = LoggerFactory.getLogger(this.getClass()); } - @BeforeMethod - public void setUp() { - bindings = new Properties(); - } - - @AfterMethod - public void tearDown() { - bindings = null; - } - - /** - * Lookup a control function by name and invoke it with a variable number of args - */ - private static Object invoke(String name,Object... args) { - // registry uses static initializer, so no need to set it up - Function function = ControlFunctionRegistry.getFunction(name); - if (function == null) { - throw new IllegalArgumentException("Unknown function " + name); - } - if (args == null) { - return function.call(bindings, new Object[0]); - } else { - return function.call(bindings, args); - } - } - @Test public void testRangeInvalidParams() { // Test number of arguments diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/TrimTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/TrimTests.java index 54bfb47ed..41c7d45c8 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/TrimTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/TrimTests.java @@ -30,16 +30,11 @@ import java.util.Properties; import org.slf4j.LoggerFactory; import org.testng.Assert; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import com.google.refine.RefineTest; import com.google.refine.expr.EvalError; -import com.google.refine.expr.functions.strings.Trim; -import com.google.refine.grel.ControlFunctionRegistry; -import com.google.refine.grel.Function; import com.google.refine.util.TestUtils; @@ -85,32 +80,6 @@ public class TrimTests extends RefineTest { logger = LoggerFactory.getLogger(this.getClass()); } - @BeforeMethod - public void SetUp() { - bindings = new Properties(); - } - - @AfterMethod - public void TearDown() { - bindings = null; - } - - /** - * Lookup a control function by name and invoke it with a variable number of args - */ - private static Object invoke(String name,Object... args) { - // registry uses static initializer, so no need to set it up - Function function = ControlFunctionRegistry.getFunction(name); - if (function == null) { - throw new IllegalArgumentException("Unknown function "+name); - } - if (args == null) { - return function.call(bindings,new Object[0]); - } else { - return function.call(bindings,args); - } - } - @Test public void testInvalidParams() { Assert.assertTrue(invoke("trim") instanceof EvalError); diff --git a/main/tests/server/src/com/google/refine/expr/functions/xml/ParseXmlTests.java b/main/tests/server/src/com/google/refine/expr/functions/xml/ParseXmlTests.java index 189e41804..213da6dae 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/xml/ParseXmlTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/xml/ParseXmlTests.java @@ -34,15 +34,10 @@ import java.util.Properties; import org.slf4j.LoggerFactory; import org.testng.Assert; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeTest; import com.google.refine.RefineTest; import com.google.refine.expr.EvalError; -import com.google.refine.expr.functions.xml.ParseXml; -import com.google.refine.grel.ControlFunctionRegistry; -import com.google.refine.grel.Function; import com.google.refine.util.TestUtils; @@ -72,32 +67,6 @@ public class ParseXmlTests extends RefineTest { logger = LoggerFactory.getLogger(this.getClass()); } - @BeforeMethod - public void SetUp() { - bindings = new Properties(); - } - - @AfterMethod - public void TearDown() { - bindings = null; - } - - /** - * Lookup a control function by name and invoke it with a variable number of args - */ - private static Object invoke(String name,Object... args) { - // registry uses static initializer, so no need to set it up - Function function = ControlFunctionRegistry.getFunction(name); - if (function == null) { - throw new IllegalArgumentException("Unknown function "+name); - } - if (args == null) { - return function.call(bindings,new Object[0]); - } else { - return function.call(bindings,args); - } - } - @Test public void serializeParseXml() { String json = "{\"description\":\"Parses a string as XML\",\"params\":\"string s\",\"returns\":\"XML object\"}"; diff --git a/main/tests/server/src/com/google/refine/grel/FunctionTests.java b/main/tests/server/src/com/google/refine/grel/FunctionTests.java index 5e671e5c2..1bf04b96e 100644 --- a/main/tests/server/src/com/google/refine/grel/FunctionTests.java +++ b/main/tests/server/src/com/google/refine/grel/FunctionTests.java @@ -54,8 +54,6 @@ import org.testng.annotations.Test; import com.google.refine.RefineTest; import com.google.refine.browsing.Engine; import com.google.refine.expr.EvalError; -import com.google.refine.grel.ControlFunctionRegistry; -import com.google.refine.grel.Function; import com.google.refine.model.Cell; import com.google.refine.model.ModelException; import com.google.refine.model.Project; @@ -63,12 +61,9 @@ import com.google.refine.model.Row; public class FunctionTests extends RefineTest { - - static Properties bindings; Project project; Engine engine; - @Override @BeforeTest public void init() { @@ -77,11 +72,10 @@ public class FunctionTests extends RefineTest { @BeforeMethod public void SetUp() throws IOException, ModelException { - project = createProjectWithColumns("FunctionTests", "Column A"); bindings = new Properties(); bindings.put("project", project); - + // Five rows of a's and five of 1s for (int i = 0; i < 10; i++) { Row row = new Row(1); @@ -95,31 +89,14 @@ public class FunctionTests extends RefineTest { public void TearDown() { bindings = null; } - - /** - * Lookup a control function by name and invoke it with a variable number of args - */ - private static Object invoke(String name,Object... args) { - // registry uses static initializer, so no need to set it up - Function function = ControlFunctionRegistry.getFunction(name); - if (function == null) { - throw new IllegalArgumentException("Unknown function "+name); - } - if (args == null) { - return function.call(bindings,new Object[0]); - } else { - return function.call(bindings,args); - } - } - + @Test public void testInvalidParams() { Assert.assertTrue(invoke("facetCount") instanceof EvalError); Assert.assertTrue(invoke("facetCount", "one","two","three") instanceof EvalError); Assert.assertTrue(invoke("facetCount", "one","bad(","Column A") instanceof EvalError); - } - + @Test public void testFacetCount() { Assert.assertEquals(invoke("facetCount", "a", "value", "Column A"),Integer.valueOf(5)); diff --git a/main/tests/server/src/com/google/refine/importers/XmlImportUtilitiesTests.java b/main/tests/server/src/com/google/refine/importers/XmlImportUtilitiesTests.java index b42e5d9c8..419546427 100644 --- a/main/tests/server/src/com/google/refine/importers/XmlImportUtilitiesTests.java +++ b/main/tests/server/src/com/google/refine/importers/XmlImportUtilitiesTests.java @@ -49,7 +49,6 @@ import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import com.google.refine.RefineTest; -import com.google.refine.importers.JsonImporter; import com.google.refine.importers.JsonImporter.JSONTreeReader; import com.google.refine.importers.XmlImporter.XmlParser; import com.google.refine.importers.tree.ImportColumn; From a50669800f4bfa45cc72946d2291a459533adb35 Mon Sep 17 00:00:00 2001 From: Tom Morris Date: Sat, 22 Aug 2020 17:38:56 -0400 Subject: [PATCH 2/5] Split up multifunction test modules Distributes the tests to individual modules per function and deletes the former multifunction test modules. --- .../refine/expr/functions/ToDateTests.java | 73 +++++- .../refine/expr/functions/ToNumberTests.java | 18 +- .../refine/expr/functions/ToStringTests.java | 32 ++- .../expr/functions/strings/EscapeTests.java | 33 ++- .../functions/strings/StringCaseTests.java | 109 --------- .../strings/ToFromConversionTests.java | 225 ------------------ .../functions/strings/ToTitlecaseTests.java | 23 +- .../functions/strings/ToUppercaseTests.java | 1 - .../expr/functions/strings/UnescapeTests.java | 13 +- 9 files changed, 181 insertions(+), 346 deletions(-) delete mode 100644 main/tests/server/src/com/google/refine/expr/functions/strings/StringCaseTests.java delete mode 100644 main/tests/server/src/com/google/refine/expr/functions/strings/ToFromConversionTests.java diff --git a/main/tests/server/src/com/google/refine/expr/functions/ToDateTests.java b/main/tests/server/src/com/google/refine/expr/functions/ToDateTests.java index 8a9622a78..49c57c17f 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/ToDateTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/ToDateTests.java @@ -26,16 +26,85 @@ ******************************************************************************/ package com.google.refine.expr.functions; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; + +import java.time.OffsetDateTime; +import java.util.TimeZone; + import org.testng.annotations.Test; -import com.google.refine.expr.functions.ToDate; +import com.google.refine.RefineTest; +import com.google.refine.expr.EvalError; +import com.google.refine.expr.util.CalendarParser; +import com.google.refine.expr.util.CalendarParserException; import com.google.refine.util.TestUtils; -public class ToDateTests { +public class ToDateTests extends RefineTest { @Test public void serializeToDate() { String json = "{\"description\":\"Returns o converted to a date object, you can hint if the day or the month is listed first, or give an ordered list of possible formats using this syntax: http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html\",\"params\":\"o, boolean month_first / format1, format2, ... (all optional)\",\"returns\":\"date\"}"; TestUtils.isSerializedTo(new ToDate(), json); } + + @Test + public void testToDate() throws CalendarParserException { + TimeZone originalTimeZone = TimeZone.getDefault(); + try { + // Inject a fixed non-UTC timezone + TimeZone.setDefault(TimeZone.getTimeZone("JST")); + + assertTrue(invoke("toDate") instanceof EvalError); + assertTrue(invoke("toDate", (Object) null) instanceof EvalError); + assertTrue(invoke("toDate", "") instanceof EvalError); + assertTrue(invoke("toDate", 1.0) instanceof EvalError); + assertTrue(invoke("toDate", "2012-03-01", "xxx") instanceof EvalError); // bad format string + assertTrue(invoke("toDate", "2012-03-01", 1L) instanceof EvalError); // non-string format arg + assertTrue(invoke("toDate", "P1M") instanceof EvalError); // Durations aren't supported + + assertTrue(invoke("toDate", "2012-03-01") instanceof OffsetDateTime); + assertEquals(invoke("toDate", "2012-03-01"),CalendarParser.parseAsOffsetDateTime("2012-03-01")); + //parse as 'month first' date with and without explicit 'true' parameter + assertEquals(invoke("toDate", "01/03/2012"),CalendarParser.parseAsOffsetDateTime("2012-01-03")); + assertEquals(invoke("toDate", "01/03/2012",true),CalendarParser.parseAsOffsetDateTime("2012-01-03")); + //parse as 'month first' date with 'false' parameter + assertEquals(invoke("toDate", "01/03/2012",false),CalendarParser.parseAsOffsetDateTime("2012-03-01")); + //parse as 'month first' date without 'false' parameter but with format specified + assertEquals(invoke("toDate", "01/03/2012","dd/MM/yyyy"),CalendarParser.parseAsOffsetDateTime("2012-03-01")); + assertEquals(invoke("toDate", "2012-03-01","yyyy-MM-dd"),CalendarParser.parseAsOffsetDateTime("2012-03-01")); + //Two digit year + assertEquals(invoke("toDate", "02-02-01"),CalendarParser.parseAsOffsetDateTime("2001-02-02")); + // Multiple format strings should get tried sequentially until one succeeds or all are exhausted + assertEquals(invoke("toDate", "2012-03-01","MMM","yyyy-MM-dd"), CalendarParser.parseAsOffsetDateTime("2012-03-01")); + + // Boolean argument combined with Multiple format strings + assertEquals(invoke("toDate", "01/03/2012",false, "MMM","yyyy-MM-dd","MM/dd/yyyy"), CalendarParser.parseAsOffsetDateTime("2012-03-01")); + + // First string can be a locale identifier instead of a format string + assertEquals(invoke("toDate", "2013-06-01","zh"), CalendarParser.parseAsOffsetDateTime("2013-06-01")); + assertEquals(invoke("toDate", "01-六月-2013","zh","dd-MMM-yyyy"), CalendarParser.parseAsOffsetDateTime("2013-06-01")); + assertEquals(invoke("toDate", "01-六月-2013", "zh-CN", "dd-MMM-yyyy"), CalendarParser.parseAsOffsetDateTime("2013-06-01")); + assertEquals(invoke("toDate", "01-六月-2013", "zh", "MMM-dd-yyyy", "dd-MMM-yyyy"), CalendarParser.parseAsOffsetDateTime("2013-06-01")); + + // If a long, convert to string + assertEquals(invoke("toDate", (long) 2012), invoke("toDate", "2012-01-01")); + + // If already a date, leave it alone + assertEquals(invoke("toDate", CalendarParser.parseAsOffsetDateTime("2012-03-01")),CalendarParser.parseAsOffsetDateTime("2012-03-01")); + + // FIXME: Date/times without timezone info were interpreted as local up until May 2018 at which point they switch to UTC + // assertEquals(invoke("toDate", "2013-06-01T13:12:11"), CalendarParser.parseAsOffsetDateTime("2013-06-01 13:12:11")); + + // These match current behavior, but would fail with the historic (pre-2018) behavior + assertEquals(invoke("toDate", "2013-06-01T13:12:11Z"), CalendarParser.parseAsOffsetDateTime("2013-06-01 13:12:11")); + assertEquals(invoke("toDate", "2013-06-01Z"), CalendarParser.parseAsOffsetDateTime("2013-06-01")); + + // TODO: more tests for datetimes with timezones and/or offsets + // assertEquals(invoke("toDate", "2013-06-01T13:12:11+06:00"), CalendarParser.parseAsOffsetDateTime("2013-06-01 13:12:11")); + } finally { + TimeZone.setDefault(originalTimeZone); + } + } + } diff --git a/main/tests/server/src/com/google/refine/expr/functions/ToNumberTests.java b/main/tests/server/src/com/google/refine/expr/functions/ToNumberTests.java index 8274392bf..3942a7232 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/ToNumberTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/ToNumberTests.java @@ -33,11 +33,12 @@ import java.util.Properties; import org.testng.annotations.Test; +import com.google.refine.RefineTest; import com.google.refine.expr.EvalError; import com.google.refine.grel.Function; import com.google.refine.util.TestUtils; -public class ToNumberTests { +public class ToNumberTests extends RefineTest { private static final Double EPSILON = 0.000001; static Properties bindings = new Properties(); @@ -56,5 +57,20 @@ public class ToNumberTests { assertTrue((Double)f.call(bindings, new Object[] {"12345.6789"}) - Double.valueOf(12345.6789) < EPSILON); assertTrue(f.call(bindings, new Object[] {"abc"}) instanceof EvalError); } + + @Test + public void testToNumber() { + assertTrue(invoke("toNumber") instanceof EvalError); + assertTrue(invoke("toNumber", (Object) null) instanceof EvalError); + assertTrue(invoke("toNumber", "") instanceof EvalError); + assertTrue(invoke("toNumber", "string") instanceof EvalError); + assertEquals(invoke("toNumber", "0.0"), 0.0); + assertEquals(invoke("toNumber", "123"), Long.valueOf(123)); + assertTrue(Math.abs((Double) invoke("toNumber", "123.456") - 123.456) < EPSILON); + assertTrue(Math.abs((Double) invoke("toNumber", "001.234") - 1.234) < EPSILON); + assertTrue(Math.abs((Double) invoke("toNumber", "1e2") - 100.0) < EPSILON); + assertTrue(Math.abs((Double) invoke("toNumber", Double.parseDouble("100.0")) - 100.0) < EPSILON); + } + } diff --git a/main/tests/server/src/com/google/refine/expr/functions/ToStringTests.java b/main/tests/server/src/com/google/refine/expr/functions/ToStringTests.java index 7a4111bb8..606180887 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/ToStringTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/ToStringTests.java @@ -26,16 +26,44 @@ ******************************************************************************/ package com.google.refine.expr.functions; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; + import org.testng.annotations.Test; -import com.google.refine.expr.functions.ToString; +import com.google.refine.RefineTest; +import com.google.refine.expr.EvalError; +import com.google.refine.expr.util.CalendarParser; +import com.google.refine.expr.util.CalendarParserException; import com.google.refine.util.TestUtils; -public class ToStringTests { +public class ToStringTests extends RefineTest { @Test public void serializeToString() { String json = "{\"description\":\"Returns o converted to a string\",\"params\":\"o, string format (optional)\",\"returns\":\"string\"}"; TestUtils.isSerializedTo(new ToString(), json); } + + @Test + public void testToString() throws CalendarParserException { + assertTrue(invoke("toString") instanceof EvalError); + assertEquals(invoke("toString", (Object) null), ""); + assertEquals(invoke("toString", Long.valueOf(100)),"100"); + assertEquals(invoke("toString", Double.valueOf(100.0)),"100.0"); + assertEquals(invoke("toString", Double.valueOf(100.0),"%.0f"),"100"); + + String inputDate = "2013-06-01"; + assertEquals(invoke("toString", CalendarParser.parseAsOffsetDateTime(inputDate)), "2013-06-01T00:00:00Z"); + assertEquals(invoke("toString", CalendarParser.parseAsOffsetDateTime(inputDate), "yyyy-MM-dd"), "2013-06-01"); + assertEquals(invoke("toString", CalendarParser.parseAsOffsetDateTime(inputDate), "yyyy/dd/MM"), "2013/01/06"); + assertEquals(invoke("toString", CalendarParser.parseAsOffsetDateTime(inputDate), "yyyy-MM-dd hh:mm:ss"), "2013-06-01 12:00:00"); + + String inputDateTime = "2013-06-01 13:12:11"; + assertEquals(invoke("toString", CalendarParser.parseAsOffsetDateTime(inputDateTime)), "2013-06-01T13:12:11Z"); + assertEquals(invoke("toString", CalendarParser.parseAsOffsetDateTime(inputDateTime), "yyyy-MM-dd"), "2013-06-01"); + assertEquals(invoke("toString", CalendarParser.parseAsOffsetDateTime(inputDateTime), "yyyy-MM-dd hh:mm:ss"),"2013-06-01 01:12:11"); + assertEquals(invoke("toString", CalendarParser.parseAsOffsetDateTime(inputDateTime), "yyyy-MM-dd HH:mm:ss"),"2013-06-01 13:12:11"); + } + } diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/EscapeTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/EscapeTests.java index 1a5ec4231..c8a353dc3 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/EscapeTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/EscapeTests.java @@ -26,16 +26,45 @@ ******************************************************************************/ package com.google.refine.expr.functions.strings; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNull; + import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.Escape; +import com.google.refine.RefineTest; import com.google.refine.util.TestUtils; -public class EscapeTests { +public class EscapeTests extends RefineTest { @Test public void serializeEscape() { String json = "{\"description\":\"Escapes a string depending on the given escaping mode.\",\"params\":\"string s, string mode ['html','xml','csv','url','javascript']\",\"returns\":\"string\"}"; TestUtils.isSerializedTo(new Escape(), json); } + + @Test + public void testEscape() { + assertNull(invoke("escape")); + assertEquals(invoke("escape",null,"xml"),""); + assertEquals(invoke("escape", "mystring", "html"),"mystring"); + assertEquals(invoke("escape", "mystring", "xml"),"mystring"); + assertEquals(invoke("escape", "mystring", "csv"),"mystring"); + assertEquals(invoke("escape", "mystring", "url"),"mystring"); + assertEquals(invoke("escape", "mystring", "javascript"),"mystring"); + assertEquals(invoke("escape", 1, "html"),"1"); + assertEquals(invoke("escape", 1, "xml"),"1"); + assertEquals(invoke("escape", 1, "csv"),"1"); + assertEquals(invoke("escape", 1, "url"),"1"); + assertEquals(invoke("escape", 1, "javascript"),"1"); + assertEquals(invoke("escape", Long.parseLong("1"), "html"),"1"); + assertEquals(invoke("escape", Long.parseLong("1"), "xml"),"1"); + assertEquals(invoke("escape", Long.parseLong("1"), "csv"),"1"); + assertEquals(invoke("escape", Long.parseLong("1"), "url"),"1"); + assertEquals(invoke("escape", Long.parseLong("1"), "javascript"),"1"); + assertEquals(invoke("escape", Double.parseDouble("1.23"), "html"),"1.23"); + assertEquals(invoke("escape", Double.parseDouble("1.23"), "xml"),"1.23"); + assertEquals(invoke("escape", Double.parseDouble("1.23"), "csv"),"1.23"); + assertEquals(invoke("escape", Double.parseDouble("1.23"), "url"),"1.23"); + assertEquals(invoke("escape", Double.parseDouble("1.23"), "javascript"),"1.23"); + } } diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/StringCaseTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/StringCaseTests.java deleted file mode 100644 index 743115f6c..000000000 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/StringCaseTests.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - -Copyright 2011, Thomas F. Morris -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - */ - -package com.google.refine.expr.functions.strings; - -import java.util.Properties; - -import org.slf4j.LoggerFactory; -import org.testng.Assert; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; - -import com.google.refine.RefineTest; -import com.google.refine.expr.EvalError; -import com.google.refine.grel.ControlFunctionRegistry; -import com.google.refine.grel.Function; - - -/** - * Tests for string up/low/title case functions. - * (A very brief start so far) - * - * @author Tom Morris - */ -public class StringCaseTests extends RefineTest { - - static Properties bindings; - - @Override - @BeforeTest - public void init() { - logger = LoggerFactory.getLogger(this.getClass()); - } - - @BeforeMethod - public void SetUp() { - bindings = new Properties(); - } - - @AfterMethod - public void TearDown() { - bindings = null; - } - - /** - * Lookup a control function by name and invoke it with a variable number of args - */ - private static Object invoke(String name,Object... args) { - // registry uses static initializer, so no need to set it up - Function function = ControlFunctionRegistry.getFunction(name); - if (function == null) { - throw new IllegalArgumentException("Unknown function "+name); - } - if (args == null) { - return function.call(bindings,new Object[0]); - } else { - return function.call(bindings,args); - } - } - - @Test - public void testToTitlecaseInvalidParams() { - Assert.assertTrue(invoke("toTitlecase") instanceof EvalError); - Assert.assertTrue(invoke("toTitlecase", "one","two","three") instanceof EvalError); - } - - @Test - public void testToTitlecase() { - Assert.assertEquals((String)(invoke("toTitlecase", "one")),"One"); - Assert.assertEquals((String)(invoke("toTitlecase", "ONE")),"One"); - Assert.assertEquals((String)(invoke("toTitlecase", "one two three")),"One Two Three"); - Assert.assertEquals((String)(invoke("toTitlecase", "C.R. SANDIDGE WINES, INC.")),"C.R. Sandidge Wines, Inc."); - Assert.assertEquals((String)(invoke("toTitlecase", "C.R. SANDIDGE WINES, INC.",",. ")),"C.R. Sandidge Wines, Inc."); - Assert.assertEquals((String)(invoke("toTitlecase", "one-two-three","-")),"One-Two-Three"); - } - -} diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/ToFromConversionTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/ToFromConversionTests.java deleted file mode 100644 index d2857433d..000000000 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/ToFromConversionTests.java +++ /dev/null @@ -1,225 +0,0 @@ -/* - -Copyright 2012, Thomas F. Morris -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - */ - -package com.google.refine.expr.functions.strings; - -import java.time.OffsetDateTime; -import java.util.Properties; -import java.util.TimeZone; - -import org.slf4j.LoggerFactory; -import org.testng.Assert; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; - -import com.google.refine.RefineTest; -import com.google.refine.expr.EvalError; -import com.google.refine.expr.util.CalendarParser; -import com.google.refine.expr.util.CalendarParserException; -import com.google.refine.grel.ControlFunctionRegistry; -import com.google.refine.grel.Function; - - -/** - * Tests for string up/low/title case functions. - * (A very brief start so far) - * - * @author Tom Morris - */ -public class ToFromConversionTests extends RefineTest { - - private static final double EPSILON = 0.0001; - static Properties bindings; - - @Override - @BeforeTest - public void init() { - logger = LoggerFactory.getLogger(this.getClass()); - } - - @BeforeMethod - public void SetUp() { - bindings = new Properties(); - } - - @AfterMethod - public void TearDown() { - bindings = null; - } - - /** - * Lookup a control function by name and invoke it with a variable number of args - */ - private static Object invoke(String name,Object... args) { - // registry uses static initializer, so no need to set it up - Function function = ControlFunctionRegistry.getFunction(name); - if (function == null) { - throw new IllegalArgumentException("Unknown function "+name); - } - if (args == null) { - return function.call(bindings,new Object[0]); - } else { - return function.call(bindings,args); - } - } - - - @Test - public void testToNumber() { - Assert.assertTrue(invoke("toNumber") instanceof EvalError); - Assert.assertTrue(invoke("toNumber", (Object) null) instanceof EvalError); - Assert.assertTrue(invoke("toNumber", "") instanceof EvalError); - Assert.assertTrue(invoke("toNumber", "string") instanceof EvalError); - Assert.assertEquals(invoke("toNumber", "0.0"), 0.0); - Assert.assertEquals(invoke("toNumber", "123"), Long.valueOf(123)); - Assert.assertTrue(Math.abs((Double) invoke("toNumber", "123.456") - 123.456) < EPSILON); - Assert.assertTrue(Math.abs((Double) invoke("toNumber", "001.234") - 1.234) < EPSILON); - Assert.assertTrue(Math.abs((Double) invoke("toNumber", "1e2") - 100.0) < EPSILON); - Assert.assertTrue(Math.abs((Double) invoke("toNumber", Double.parseDouble("100.0")) - 100.0) < EPSILON); - } - - @Test - public void testToString() throws CalendarParserException { - Assert.assertTrue(invoke("toString") instanceof EvalError); - Assert.assertEquals(invoke("toString", (Object) null), ""); - Assert.assertEquals(invoke("toString", Long.valueOf(100)),"100"); - Assert.assertEquals(invoke("toString", Double.valueOf(100.0)),"100.0"); - Assert.assertEquals(invoke("toString", Double.valueOf(100.0),"%.0f"),"100"); - - String inputDate = "2013-06-01"; - Assert.assertEquals(invoke("toString", CalendarParser.parseAsOffsetDateTime(inputDate)), "2013-06-01T00:00:00Z"); - Assert.assertEquals(invoke("toString", CalendarParser.parseAsOffsetDateTime(inputDate), "yyyy-MM-dd"), "2013-06-01"); - Assert.assertEquals(invoke("toString", CalendarParser.parseAsOffsetDateTime(inputDate), "yyyy/dd/MM"), "2013/01/06"); - Assert.assertEquals(invoke("toString", CalendarParser.parseAsOffsetDateTime(inputDate), "yyyy-MM-dd hh:mm:ss"), "2013-06-01 12:00:00"); - - String inputDateTime = "2013-06-01 13:12:11"; - Assert.assertEquals(invoke("toString", CalendarParser.parseAsOffsetDateTime(inputDateTime)), "2013-06-01T13:12:11Z"); - Assert.assertEquals(invoke("toString", CalendarParser.parseAsOffsetDateTime(inputDateTime), "yyyy-MM-dd"), "2013-06-01"); - Assert.assertEquals(invoke("toString", CalendarParser.parseAsOffsetDateTime(inputDateTime), "yyyy-MM-dd hh:mm:ss"),"2013-06-01 01:12:11"); - Assert.assertEquals(invoke("toString", CalendarParser.parseAsOffsetDateTime(inputDateTime), "yyyy-MM-dd HH:mm:ss"),"2013-06-01 13:12:11"); - } - - @Test - public void testToDate() throws CalendarParserException { - TimeZone originalTimeZone = TimeZone.getDefault(); - try { - // Inject a fixed non-UTC timezone - TimeZone.setDefault(TimeZone.getTimeZone("JST")); - - Assert.assertTrue(invoke("toDate") instanceof EvalError); - Assert.assertTrue(invoke("toDate", (Object) null) instanceof EvalError); - Assert.assertTrue(invoke("toDate", "") instanceof EvalError); - Assert.assertTrue(invoke("toDate", 1.0) instanceof EvalError); - Assert.assertTrue(invoke("toDate", "2012-03-01", "xxx") instanceof EvalError); // bad format string - Assert.assertTrue(invoke("toDate", "2012-03-01", 1L) instanceof EvalError); // non-string format arg - Assert.assertTrue(invoke("toDate", "P1M") instanceof EvalError); // Durations aren't supported - - Assert.assertTrue(invoke("toDate", "2012-03-01") instanceof OffsetDateTime); - Assert.assertEquals(invoke("toDate", "2012-03-01"),CalendarParser.parseAsOffsetDateTime("2012-03-01")); - //parse as 'month first' date with and without explicit 'true' parameter - Assert.assertEquals(invoke("toDate", "01/03/2012"),CalendarParser.parseAsOffsetDateTime("2012-01-03")); - Assert.assertEquals(invoke("toDate", "01/03/2012",true),CalendarParser.parseAsOffsetDateTime("2012-01-03")); - //parse as 'month first' date with 'false' parameter - Assert.assertEquals(invoke("toDate", "01/03/2012",false),CalendarParser.parseAsOffsetDateTime("2012-03-01")); - //parse as 'month first' date without 'false' parameter but with format specified - Assert.assertEquals(invoke("toDate", "01/03/2012","dd/MM/yyyy"),CalendarParser.parseAsOffsetDateTime("2012-03-01")); - Assert.assertEquals(invoke("toDate", "2012-03-01","yyyy-MM-dd"),CalendarParser.parseAsOffsetDateTime("2012-03-01")); - //Two digit year - Assert.assertEquals(invoke("toDate", "02-02-01"),CalendarParser.parseAsOffsetDateTime("2001-02-02")); - // Multiple format strings should get tried sequentially until one succeeds or all are exhausted - Assert.assertEquals(invoke("toDate", "2012-03-01","MMM","yyyy-MM-dd"), CalendarParser.parseAsOffsetDateTime("2012-03-01")); - - // Boolean argument combined with Multiple format strings - Assert.assertEquals(invoke("toDate", "01/03/2012",false, "MMM","yyyy-MM-dd","MM/dd/yyyy"), CalendarParser.parseAsOffsetDateTime("2012-03-01")); - - // First string can be a locale identifier instead of a format string - Assert.assertEquals(invoke("toDate", "2013-06-01","zh"), CalendarParser.parseAsOffsetDateTime("2013-06-01")); - Assert.assertEquals(invoke("toDate", "01-六月-2013","zh","dd-MMM-yyyy"), CalendarParser.parseAsOffsetDateTime("2013-06-01")); - Assert.assertEquals(invoke("toDate", "01-六月-2013", "zh-CN", "dd-MMM-yyyy"), CalendarParser.parseAsOffsetDateTime("2013-06-01")); - Assert.assertEquals(invoke("toDate", "01-六月-2013", "zh", "MMM-dd-yyyy", "dd-MMM-yyyy"), CalendarParser.parseAsOffsetDateTime("2013-06-01")); - - // If a long, convert to string - Assert.assertEquals(invoke("toDate", (long) 2012), invoke("toDate", "2012-01-01")); - - // If already a date, leave it alone - Assert.assertEquals(invoke("toDate", CalendarParser.parseAsOffsetDateTime("2012-03-01")),CalendarParser.parseAsOffsetDateTime("2012-03-01")); - - // FIXME: Date/times without timezone info were interpreted as local up until May 2018 at which point they switch to UTC - // Assert.assertEquals(invoke("toDate", "2013-06-01T13:12:11"), CalendarParser.parseAsOffsetDateTime("2013-06-01 13:12:11")); - - // These match current behavior, but would fail with the historic (pre-2018) behavior - Assert.assertEquals(invoke("toDate", "2013-06-01T13:12:11Z"), CalendarParser.parseAsOffsetDateTime("2013-06-01 13:12:11")); - Assert.assertEquals(invoke("toDate", "2013-06-01Z"), CalendarParser.parseAsOffsetDateTime("2013-06-01")); - - // TODO: more tests for datetimes with timezones and/or offsets - // Assert.assertEquals(invoke("toDate", "2013-06-01T13:12:11+06:00"), CalendarParser.parseAsOffsetDateTime("2013-06-01 13:12:11")); - } finally { - TimeZone.setDefault(originalTimeZone); - } - } - - @Test - public void testEscape() { - Assert.assertNull(invoke("escape")); - Assert.assertEquals(invoke("escape",null,"xml"),""); - Assert.assertEquals(invoke("escape", "mystring", "html"),"mystring"); - Assert.assertEquals(invoke("escape", "mystring", "xml"),"mystring"); - Assert.assertEquals(invoke("escape", "mystring", "csv"),"mystring"); - Assert.assertEquals(invoke("escape", "mystring", "url"),"mystring"); - Assert.assertEquals(invoke("escape", "mystring", "javascript"),"mystring"); - Assert.assertEquals(invoke("escape", 1, "html"),"1"); - Assert.assertEquals(invoke("escape", 1, "xml"),"1"); - Assert.assertEquals(invoke("escape", 1, "csv"),"1"); - Assert.assertEquals(invoke("escape", 1, "url"),"1"); - Assert.assertEquals(invoke("escape", 1, "javascript"),"1"); - Assert.assertEquals(invoke("escape", Long.parseLong("1"), "html"),"1"); - Assert.assertEquals(invoke("escape", Long.parseLong("1"), "xml"),"1"); - Assert.assertEquals(invoke("escape", Long.parseLong("1"), "csv"),"1"); - Assert.assertEquals(invoke("escape", Long.parseLong("1"), "url"),"1"); - Assert.assertEquals(invoke("escape", Long.parseLong("1"), "javascript"),"1"); - Assert.assertEquals(invoke("escape", Double.parseDouble("1.23"), "html"),"1.23"); - Assert.assertEquals(invoke("escape", Double.parseDouble("1.23"), "xml"),"1.23"); - Assert.assertEquals(invoke("escape", Double.parseDouble("1.23"), "csv"),"1.23"); - Assert.assertEquals(invoke("escape", Double.parseDouble("1.23"), "url"),"1.23"); - Assert.assertEquals(invoke("escape", Double.parseDouble("1.23"), "javascript"),"1.23"); - } - - @Test - public void testUnescape() { - Assert.assertEquals(invoke("unescape", "Ä", "html"),"Ä"); - Assert.assertEquals(invoke("unescape", "\\u00C4", "javascript"),"Ä"); - } - -} diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/ToTitlecaseTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/ToTitlecaseTests.java index cc8ddd0c3..e7316c287 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/ToTitlecaseTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/ToTitlecaseTests.java @@ -26,16 +26,35 @@ ******************************************************************************/ package com.google.refine.expr.functions.strings; +import org.testng.Assert; import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.ToTitlecase; +import com.google.refine.RefineTest; +import com.google.refine.expr.EvalError; import com.google.refine.util.TestUtils; -public class ToTitlecaseTests { +public class ToTitlecaseTests extends RefineTest { @Test public void serializeToTitlecase() { String json = "{\"description\":\"Returns s converted to titlecase\",\"params\":\"string s\",\"returns\":\"string\"}"; TestUtils.isSerializedTo(new ToTitlecase(), json); } + + @Test + public void testToTitlecaseInvalidParams() { + Assert.assertTrue(invoke("toTitlecase") instanceof EvalError); + Assert.assertTrue(invoke("toTitlecase", "one","two","three") instanceof EvalError); + } + + @Test + public void testToTitlecase() { + Assert.assertEquals((String)(invoke("toTitlecase", "one")),"One"); + Assert.assertEquals((String)(invoke("toTitlecase", "ONE")),"One"); + Assert.assertEquals((String)(invoke("toTitlecase", "one two three")),"One Two Three"); + Assert.assertEquals((String)(invoke("toTitlecase", "C.R. SANDIDGE WINES, INC.")),"C.R. Sandidge Wines, Inc."); + Assert.assertEquals((String)(invoke("toTitlecase", "C.R. SANDIDGE WINES, INC.",",. ")),"C.R. Sandidge Wines, Inc."); + Assert.assertEquals((String)(invoke("toTitlecase", "one-two-three","-")),"One-Two-Three"); + } + } diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/ToUppercaseTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/ToUppercaseTests.java index b92672d73..fadac139d 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/ToUppercaseTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/ToUppercaseTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.strings; import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.ToUppercase; import com.google.refine.util.TestUtils; public class ToUppercaseTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/UnescapeTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/UnescapeTests.java index 79e869d50..fb93c21e6 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/UnescapeTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/UnescapeTests.java @@ -26,16 +26,25 @@ ******************************************************************************/ package com.google.refine.expr.functions.strings; +import static org.testng.AssertJUnit.assertEquals; + import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.Unescape; +import com.google.refine.RefineTest; import com.google.refine.util.TestUtils; -public class UnescapeTests { +public class UnescapeTests extends RefineTest { @Test public void serializeUnescape() { String json = "{\"description\":\"Unescapes all escaped parts of the string depending on the given escaping mode.\",\"params\":\"string s, string mode ['html','xml','csv','url','javascript']\",\"returns\":\"string\"}"; TestUtils.isSerializedTo(new Unescape(), json); } + + @Test + public void testUnescape() { + assertEquals(invoke("unescape", "Ä", "html"),"Ä"); + assertEquals(invoke("unescape", "\\u00C4", "javascript"),"Ä"); + } + } From b5aea3b780d849b48393e615d2f530356989d41e Mon Sep 17 00:00:00 2001 From: Tom Morris Date: Sat, 22 Aug 2020 17:56:08 -0400 Subject: [PATCH 3/5] Remove unused imports --- .../server/src/com/google/refine/commands/CommandStub.java | 1 - .../google/refine/commands/OpenWorkspaceDirCommandTests.java | 2 +- .../google/refine/commands/SetPreferenceCommandTests.java | 1 - .../commands/browsing/ScatterplotDrawCommandTests.java | 1 - .../commands/cell/JoinMultiValueCellsCommandTests.java | 1 - .../commands/expr/GetExpressionHistoryCommandTests.java | 2 -- .../commands/expr/GetStarredExpressionsCommandTests.java | 2 -- .../refine/commands/expr/LogExpressionCommandTests.java | 1 - .../commands/project/SetProjectMetadataCommandTests.java | 1 - .../src/com/google/refine/exporters/CsvExporterTests.java | 1 - .../src/com/google/refine/exporters/HtmlExporterTests.java | 2 -- .../com/google/refine/exporters/TemplatingExporterTests.java | 2 -- .../src/com/google/refine/exporters/TsvExporterTests.java | 1 - .../src/com/google/refine/exporters/XlsExporterTests.java | 2 -- .../src/com/google/refine/exporters/XlsxExporterTests.java | 2 -- .../server/src/com/google/refine/expr/EvalErrorTests.java | 1 - .../src/com/google/refine/expr/ExpressionUtilsTests.java | 1 - .../com/google/refine/expr/functions/FacetCountTests.java | 1 - .../src/com/google/refine/expr/functions/GetTests.java | 1 - .../src/com/google/refine/expr/functions/HasFieldTests.java | 1 - .../src/com/google/refine/expr/functions/JsonizeTests.java | 1 - .../src/com/google/refine/expr/functions/LengthTests.java | 1 - .../src/com/google/refine/expr/functions/SliceTests.java | 1 - .../com/google/refine/expr/functions/arrays/JoinTests.java | 1 - .../google/refine/expr/functions/arrays/ReverseTests.java | 1 - .../com/google/refine/expr/functions/arrays/SortTests.java | 1 - .../google/refine/expr/functions/arrays/UniquesTests.java | 1 - .../com/google/refine/expr/functions/booleans/AndTests.java | 1 - .../com/google/refine/expr/functions/booleans/NotTests.java | 1 - .../com/google/refine/expr/functions/booleans/OrTests.java | 1 - .../com/google/refine/expr/functions/booleans/XorTests.java | 1 - .../google/refine/expr/functions/html/InnerHtmlTests.java | 1 - .../src/com/google/refine/expr/functions/math/ACosTests.java | 1 - .../src/com/google/refine/expr/functions/math/ASinTests.java | 1 - .../com/google/refine/expr/functions/math/ATan2Tests.java | 1 - .../src/com/google/refine/expr/functions/math/ATanTests.java | 1 - .../src/com/google/refine/expr/functions/math/AbsTests.java | 1 - .../src/com/google/refine/expr/functions/math/CeilTests.java | 1 - .../com/google/refine/expr/functions/math/CombinTests.java | 1 - .../src/com/google/refine/expr/functions/math/CosTests.java | 1 - .../src/com/google/refine/expr/functions/math/CoshTests.java | 1 - .../com/google/refine/expr/functions/math/DegreesTests.java | 1 - .../src/com/google/refine/expr/functions/math/EvenTests.java | 1 - .../src/com/google/refine/expr/functions/math/ExpTests.java | 1 - .../com/google/refine/expr/functions/math/FactNTests.java | 1 - .../src/com/google/refine/expr/functions/math/FactTests.java | 1 - .../com/google/refine/expr/functions/math/FloorTests.java | 1 - .../expr/functions/math/GreatestCommonDenominatorTests.java | 1 - .../refine/expr/functions/math/LeastCommonMultipleTests.java | 1 - .../src/com/google/refine/expr/functions/math/LnTests.java | 1 - .../src/com/google/refine/expr/functions/math/LogTests.java | 1 - .../src/com/google/refine/expr/functions/math/MaxTests.java | 1 - .../src/com/google/refine/expr/functions/math/MinTests.java | 1 - .../src/com/google/refine/expr/functions/math/ModTests.java | 1 - .../google/refine/expr/functions/math/MultinomialTests.java | 1 - .../src/com/google/refine/expr/functions/math/OddTests.java | 1 - .../src/com/google/refine/expr/functions/math/PowTests.java | 1 - .../com/google/refine/expr/functions/math/QuotientTests.java | 1 - .../com/google/refine/expr/functions/math/RadiansTests.java | 1 - .../com/google/refine/expr/functions/math/RoundTests.java | 1 - .../src/com/google/refine/expr/functions/math/SinTests.java | 1 - .../src/com/google/refine/expr/functions/math/SinhTests.java | 1 - .../src/com/google/refine/expr/functions/math/SumTests.java | 1 - .../src/com/google/refine/expr/functions/math/TanTests.java | 1 - .../src/com/google/refine/expr/functions/math/TanhTests.java | 1 - .../com/google/refine/expr/functions/strings/ChompTests.java | 1 - .../google/refine/expr/functions/strings/EndsWithTests.java | 1 - .../google/refine/expr/functions/strings/IndexOfTests.java | 1 - .../refine/expr/functions/strings/LastIndexOfTests.java | 1 - .../com/google/refine/expr/functions/strings/MD5Tests.java | 1 - .../com/google/refine/expr/functions/strings/MatchTests.java | 1 - .../refine/expr/functions/strings/NGramFingerprintTests.java | 1 - .../com/google/refine/expr/functions/strings/NGramTests.java | 1 - .../google/refine/expr/functions/strings/ParseJsonTests.java | 1 - .../google/refine/expr/functions/strings/PartitionTests.java | 1 - .../google/refine/expr/functions/strings/PhoneticTests.java | 1 - .../refine/expr/functions/strings/RPartitionTests.java | 1 - .../refine/expr/functions/strings/ReinterpretTests.java | 1 - .../refine/expr/functions/strings/ReplaceCharsTests.java | 1 - .../google/refine/expr/functions/strings/ReplaceTests.java | 1 - .../com/google/refine/expr/functions/strings/SHA1Tests.java | 1 - .../refine/expr/functions/strings/SplitByCharTypeTests.java | 1 - .../refine/expr/functions/strings/SplitByLengthsTests.java | 1 - .../com/google/refine/expr/functions/strings/SplitTests.java | 1 - .../refine/expr/functions/strings/StartsWithTests.java | 1 - .../refine/expr/functions/strings/ToLowercaseTests.java | 1 - .../google/refine/expr/functions/strings/UnicodeTests.java | 1 - .../refine/expr/functions/strings/UnicodeTypeTests.java | 1 - .../com/google/refine/expr/functions/xml/InnerXmlTests.java | 1 - .../com/google/refine/expr/functions/xml/OwnTextTests.java | 1 - .../com/google/refine/expr/functions/xml/SelectXmlTests.java | 1 - .../com/google/refine/expr/functions/xml/xmlAttrTests.java | 1 - .../com/google/refine/expr/functions/xml/xmlTextTests.java | 1 - .../src/com/google/refine/grel/ast/LiteralExprTest.java | 2 -- .../src/com/google/refine/grel/controls/FilterTests.java | 1 - .../com/google/refine/grel/controls/ForEachIndexTests.java | 1 - .../src/com/google/refine/grel/controls/ForEachTests.java | 1 - .../com/google/refine/grel/controls/ForNonBlankTests.java | 1 - .../src/com/google/refine/grel/controls/ForRangeTests.java | 1 - .../server/src/com/google/refine/grel/controls/IfTests.java | 1 - .../src/com/google/refine/grel/controls/IsBlankTests.java | 1 - .../com/google/refine/grel/controls/IsEmptyStringTests.java | 1 - .../src/com/google/refine/grel/controls/IsErrorTests.java | 1 - .../src/com/google/refine/grel/controls/IsNonBlankTests.java | 1 - .../src/com/google/refine/grel/controls/IsNotNullTests.java | 1 - .../src/com/google/refine/grel/controls/IsNullTests.java | 1 - .../src/com/google/refine/grel/controls/IsNumericTests.java | 1 - .../src/com/google/refine/grel/controls/WithTests.java | 1 - .../google/refine/history/FileHistoryEntryManagerTests.java | 1 - .../src/com/google/refine/history/HistoryEntryTests.java | 1 - .../server/src/com/google/refine/history/HistoryTests.java | 4 ---- .../com/google/refine/importers/ImporterUtilitiesTests.java | 1 - .../com/google/refine/importers/WikitextImporterTests.java | 3 +-- .../src/com/google/refine/io/FileProjectManagerTests.java | 1 - .../tests/server/src/com/google/refine/model/CacheTests.java | 5 +---- main/tests/server/src/com/google/refine/model/CellTests.java | 2 -- .../server/src/com/google/refine/model/ColumnGroupTests.java | 1 - .../server/src/com/google/refine/model/ColumnModelTests.java | 2 -- .../server/src/com/google/refine/model/ColumnTests.java | 1 - .../server/src/com/google/refine/model/ProjectStub.java | 2 -- .../src/com/google/refine/model/ReconCandidateTests.java | 1 - .../server/src/com/google/refine/model/ReconStatsTests.java | 1 - .../tests/server/src/com/google/refine/model/ReconTests.java | 1 - .../server/src/com/google/refine/model/ReconTypeTest.java | 1 - .../server/src/com/google/refine/model/RecordModelTests.java | 1 - main/tests/server/src/com/google/refine/model/RowTests.java | 1 - .../google/refine/model/changes/DataExtensionChangeTest.java | 1 - .../src/com/google/refine/model/changes/MassChangeTests.java | 3 --- .../com/google/refine/operations/cell/BlankDownTests.java | 2 -- .../src/com/google/refine/operations/cell/FillDownTests.java | 1 - .../refine/operations/cell/JoinMultiValuedCellsTests.java | 1 - .../google/refine/operations/cell/MassOperationTests.java | 1 - .../refine/operations/cell/SplitMultiValuedCellsTests.java | 1 - .../com/google/refine/operations/cell/TransposeTests.java | 1 - .../column/ColumnAdditionByFetchingURLsOperationTests.java | 1 - .../operations/column/ColumnAdditionOperationTests.java | 1 - .../refine/operations/column/ColumnMoveOperationTests.java | 1 - .../operations/column/ColumnRemovalOperationTests.java | 1 - .../refine/operations/column/ColumnRenameOperationTests.java | 1 - .../operations/column/ColumnReorderOperationTests.java | 1 - .../refine/operations/column/ColumnSplitOperationTests.java | 1 - .../refine/operations/row/DenormalizeOperationTests.java | 1 - .../google/refine/operations/row/RowFlagOperationTests.java | 1 - .../refine/operations/row/RowRemovalOperationTests.java | 1 - .../refine/operations/row/RowReorderOperationTests.java | 1 - .../google/refine/operations/row/RowStarOperationTests.java | 1 - .../com/google/refine/preference/PreferenceStoreTests.java | 1 - .../src/com/google/refine/preference/TopListTests.java | 2 -- .../com/google/refine/process/LongRunningProcessTests.java | 1 - .../src/com/google/refine/process/ProcessManagerTests.java | 2 -- .../google/refine/process/QuickHistoryEntryProcessTests.java | 2 -- .../src/com/google/refine/sorting/BooleanCriterionTest.java | 1 - .../src/com/google/refine/sorting/DateCriterionTest.java | 1 - .../src/com/google/refine/sorting/NumberCriterionTest.java | 1 - .../src/com/google/refine/sorting/SortingConfigTests.java | 1 - .../refine/util/PatternSyntaxExceptionParserTests.java | 1 - 156 files changed, 3 insertions(+), 179 deletions(-) diff --git a/main/tests/server/src/com/google/refine/commands/CommandStub.java b/main/tests/server/src/com/google/refine/commands/CommandStub.java index 8a1009204..2a7818458 100644 --- a/main/tests/server/src/com/google/refine/commands/CommandStub.java +++ b/main/tests/server/src/com/google/refine/commands/CommandStub.java @@ -38,7 +38,6 @@ import javax.servlet.http.HttpServletRequest; import com.google.refine.browsing.Engine; import com.google.refine.browsing.EngineConfig; -import com.google.refine.commands.Command; import com.google.refine.model.Project; /** diff --git a/main/tests/server/src/com/google/refine/commands/OpenWorkspaceDirCommandTests.java b/main/tests/server/src/com/google/refine/commands/OpenWorkspaceDirCommandTests.java index 770b86a66..46d2cb8a6 100644 --- a/main/tests/server/src/com/google/refine/commands/OpenWorkspaceDirCommandTests.java +++ b/main/tests/server/src/com/google/refine/commands/OpenWorkspaceDirCommandTests.java @@ -1,5 +1,5 @@ package com.google.refine.commands; -import com.google.refine.commands.CommandTestBase; + import java.io.IOException; import javax.servlet.ServletException; diff --git a/main/tests/server/src/com/google/refine/commands/SetPreferenceCommandTests.java b/main/tests/server/src/com/google/refine/commands/SetPreferenceCommandTests.java index 9ad95db7c..25dec760e 100644 --- a/main/tests/server/src/com/google/refine/commands/SetPreferenceCommandTests.java +++ b/main/tests/server/src/com/google/refine/commands/SetPreferenceCommandTests.java @@ -1,6 +1,5 @@ package com.google.refine.commands; -import com.google.refine.commands.CommandTestBase; import java.io.IOException; import javax.servlet.ServletException; diff --git a/main/tests/server/src/com/google/refine/commands/browsing/ScatterplotDrawCommandTests.java b/main/tests/server/src/com/google/refine/commands/browsing/ScatterplotDrawCommandTests.java index b3b416d4a..f9d1138fd 100644 --- a/main/tests/server/src/com/google/refine/commands/browsing/ScatterplotDrawCommandTests.java +++ b/main/tests/server/src/com/google/refine/commands/browsing/ScatterplotDrawCommandTests.java @@ -18,7 +18,6 @@ import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; import com.google.refine.browsing.facets.ScatterplotFacet; import com.google.refine.commands.Command; -import com.google.refine.commands.browsing.GetScatterplotCommand; import com.google.refine.util.ParsingUtilities; public class ScatterplotDrawCommandTests { diff --git a/main/tests/server/src/com/google/refine/commands/cell/JoinMultiValueCellsCommandTests.java b/main/tests/server/src/com/google/refine/commands/cell/JoinMultiValueCellsCommandTests.java index e9678d367..b837e2760 100644 --- a/main/tests/server/src/com/google/refine/commands/cell/JoinMultiValueCellsCommandTests.java +++ b/main/tests/server/src/com/google/refine/commands/cell/JoinMultiValueCellsCommandTests.java @@ -8,7 +8,6 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import com.google.refine.commands.CommandTestBase; -import com.google.refine.commands.cell.JoinMultiValueCellsCommand; public class JoinMultiValueCellsCommandTests extends CommandTestBase { diff --git a/main/tests/server/src/com/google/refine/commands/expr/GetExpressionHistoryCommandTests.java b/main/tests/server/src/com/google/refine/commands/expr/GetExpressionHistoryCommandTests.java index 5f7d41d67..3c5281d2d 100644 --- a/main/tests/server/src/com/google/refine/commands/expr/GetExpressionHistoryCommandTests.java +++ b/main/tests/server/src/com/google/refine/commands/expr/GetExpressionHistoryCommandTests.java @@ -33,8 +33,6 @@ import javax.servlet.ServletException; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import com.google.refine.commands.expr.GetExpressionHistoryCommand; - public class GetExpressionHistoryCommandTests extends ExpressionCommandTestBase { @BeforeMethod diff --git a/main/tests/server/src/com/google/refine/commands/expr/GetStarredExpressionsCommandTests.java b/main/tests/server/src/com/google/refine/commands/expr/GetStarredExpressionsCommandTests.java index 4c741e838..3ec11b4e2 100644 --- a/main/tests/server/src/com/google/refine/commands/expr/GetStarredExpressionsCommandTests.java +++ b/main/tests/server/src/com/google/refine/commands/expr/GetStarredExpressionsCommandTests.java @@ -33,8 +33,6 @@ import javax.servlet.ServletException; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import com.google.refine.commands.expr.GetStarredExpressionsCommand; - public class GetStarredExpressionsCommandTests extends ExpressionCommandTestBase { @BeforeMethod diff --git a/main/tests/server/src/com/google/refine/commands/expr/LogExpressionCommandTests.java b/main/tests/server/src/com/google/refine/commands/expr/LogExpressionCommandTests.java index 9222a76e2..8a7acd604 100644 --- a/main/tests/server/src/com/google/refine/commands/expr/LogExpressionCommandTests.java +++ b/main/tests/server/src/com/google/refine/commands/expr/LogExpressionCommandTests.java @@ -3,7 +3,6 @@ package com.google.refine.commands.expr; import static org.mockito.Mockito.when; import static org.mockito.Mockito.mock; import com.google.refine.ProjectManager; -import com.google.refine.ProjectManagerStub; import com.google.refine.commands.Command; import com.google.refine.commands.CommandTestBase; import com.google.refine.preference.PreferenceStore; diff --git a/main/tests/server/src/com/google/refine/commands/project/SetProjectMetadataCommandTests.java b/main/tests/server/src/com/google/refine/commands/project/SetProjectMetadataCommandTests.java index 008dc08fb..3f1fe8ffa 100644 --- a/main/tests/server/src/com/google/refine/commands/project/SetProjectMetadataCommandTests.java +++ b/main/tests/server/src/com/google/refine/commands/project/SetProjectMetadataCommandTests.java @@ -59,7 +59,6 @@ import com.google.refine.ProjectManager; import com.google.refine.ProjectMetadata; import com.google.refine.RefineTest; import com.google.refine.commands.Command; -import com.google.refine.commands.project.SetProjectMetadataCommand; import com.google.refine.model.Project; import com.google.refine.util.ParsingUtilities; diff --git a/main/tests/server/src/com/google/refine/exporters/CsvExporterTests.java b/main/tests/server/src/com/google/refine/exporters/CsvExporterTests.java index e57b8e989..11475a227 100644 --- a/main/tests/server/src/com/google/refine/exporters/CsvExporterTests.java +++ b/main/tests/server/src/com/google/refine/exporters/CsvExporterTests.java @@ -51,7 +51,6 @@ import org.testng.annotations.Test; import com.google.refine.RefineTest; import com.google.refine.browsing.Engine; -import com.google.refine.exporters.CsvExporter; import com.google.refine.model.Cell; import com.google.refine.model.Column; import com.google.refine.model.ModelException; diff --git a/main/tests/server/src/com/google/refine/exporters/HtmlExporterTests.java b/main/tests/server/src/com/google/refine/exporters/HtmlExporterTests.java index 0b3eb5ac8..b5bb202bf 100644 --- a/main/tests/server/src/com/google/refine/exporters/HtmlExporterTests.java +++ b/main/tests/server/src/com/google/refine/exporters/HtmlExporterTests.java @@ -54,8 +54,6 @@ import com.google.refine.ProjectManagerStub; import com.google.refine.ProjectMetadata; import com.google.refine.RefineTest; import com.google.refine.browsing.Engine; -import com.google.refine.exporters.HtmlTableExporter; -import com.google.refine.exporters.WriterExporter; import com.google.refine.model.Cell; import com.google.refine.model.Column; import com.google.refine.model.ModelException; diff --git a/main/tests/server/src/com/google/refine/exporters/TemplatingExporterTests.java b/main/tests/server/src/com/google/refine/exporters/TemplatingExporterTests.java index 768264c59..57819ed02 100644 --- a/main/tests/server/src/com/google/refine/exporters/TemplatingExporterTests.java +++ b/main/tests/server/src/com/google/refine/exporters/TemplatingExporterTests.java @@ -52,8 +52,6 @@ import com.google.refine.ProjectManagerStub; import com.google.refine.ProjectMetadata; import com.google.refine.RefineTest; import com.google.refine.browsing.Engine; -import com.google.refine.exporters.TemplatingExporter; -import com.google.refine.exporters.WriterExporter; import com.google.refine.model.Cell; import com.google.refine.model.Column; import com.google.refine.model.ModelException; diff --git a/main/tests/server/src/com/google/refine/exporters/TsvExporterTests.java b/main/tests/server/src/com/google/refine/exporters/TsvExporterTests.java index 7a81be605..bd27ec8c3 100644 --- a/main/tests/server/src/com/google/refine/exporters/TsvExporterTests.java +++ b/main/tests/server/src/com/google/refine/exporters/TsvExporterTests.java @@ -51,7 +51,6 @@ import org.testng.annotations.Test; import com.google.refine.RefineTest; import com.google.refine.browsing.Engine; -import com.google.refine.exporters.CsvExporter; import com.google.refine.model.Cell; import com.google.refine.model.Column; import com.google.refine.model.ModelException; diff --git a/main/tests/server/src/com/google/refine/exporters/XlsExporterTests.java b/main/tests/server/src/com/google/refine/exporters/XlsExporterTests.java index 78ad67877..6b04c8521 100644 --- a/main/tests/server/src/com/google/refine/exporters/XlsExporterTests.java +++ b/main/tests/server/src/com/google/refine/exporters/XlsExporterTests.java @@ -58,8 +58,6 @@ import com.google.refine.ProjectManagerStub; import com.google.refine.ProjectMetadata; import com.google.refine.RefineTest; import com.google.refine.browsing.Engine; -import com.google.refine.exporters.StreamExporter; -import com.google.refine.exporters.XlsExporter; import com.google.refine.model.Cell; import com.google.refine.model.Column; import com.google.refine.model.ModelException; diff --git a/main/tests/server/src/com/google/refine/exporters/XlsxExporterTests.java b/main/tests/server/src/com/google/refine/exporters/XlsxExporterTests.java index 22d0e3e1b..bad83267e 100644 --- a/main/tests/server/src/com/google/refine/exporters/XlsxExporterTests.java +++ b/main/tests/server/src/com/google/refine/exporters/XlsxExporterTests.java @@ -61,8 +61,6 @@ import com.google.refine.ProjectManagerStub; import com.google.refine.ProjectMetadata; import com.google.refine.RefineTest; import com.google.refine.browsing.Engine; -import com.google.refine.exporters.StreamExporter; -import com.google.refine.exporters.XlsExporter; import com.google.refine.model.Cell; import com.google.refine.model.Column; import com.google.refine.model.ModelException; diff --git a/main/tests/server/src/com/google/refine/expr/EvalErrorTests.java b/main/tests/server/src/com/google/refine/expr/EvalErrorTests.java index 05b9c5493..3b8b5ed86 100644 --- a/main/tests/server/src/com/google/refine/expr/EvalErrorTests.java +++ b/main/tests/server/src/com/google/refine/expr/EvalErrorTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr; import org.testng.annotations.Test; -import com.google.refine.expr.EvalError; import com.google.refine.util.TestUtils; public class EvalErrorTests { diff --git a/main/tests/server/src/com/google/refine/expr/ExpressionUtilsTests.java b/main/tests/server/src/com/google/refine/expr/ExpressionUtilsTests.java index b6c9e609d..af2391fd3 100644 --- a/main/tests/server/src/com/google/refine/expr/ExpressionUtilsTests.java +++ b/main/tests/server/src/com/google/refine/expr/ExpressionUtilsTests.java @@ -40,7 +40,6 @@ import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import com.google.refine.RefineTest; -import com.google.refine.expr.ExpressionUtils; public class ExpressionUtilsTests extends RefineTest { diff --git a/main/tests/server/src/com/google/refine/expr/functions/FacetCountTests.java b/main/tests/server/src/com/google/refine/expr/functions/FacetCountTests.java index e3ac35e0c..b6c2bc2a6 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/FacetCountTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/FacetCountTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions; import org.testng.annotations.Test; -import com.google.refine.expr.functions.FacetCount; import com.google.refine.util.TestUtils; public class FacetCountTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/GetTests.java b/main/tests/server/src/com/google/refine/expr/functions/GetTests.java index 9ee0fc850..2c009a4d8 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/GetTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/GetTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions; import org.testng.annotations.Test; -import com.google.refine.expr.functions.Get; import com.google.refine.util.TestUtils; public class GetTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/HasFieldTests.java b/main/tests/server/src/com/google/refine/expr/functions/HasFieldTests.java index 99f4292cd..b1d5af35b 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/HasFieldTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/HasFieldTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions; import org.testng.annotations.Test; -import com.google.refine.expr.functions.HasField; import com.google.refine.util.TestUtils; public class HasFieldTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/JsonizeTests.java b/main/tests/server/src/com/google/refine/expr/functions/JsonizeTests.java index bf5dc700e..efdbc22c8 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/JsonizeTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/JsonizeTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions; import org.testng.annotations.Test; -import com.google.refine.expr.functions.Jsonize; import com.google.refine.util.TestUtils; public class JsonizeTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/LengthTests.java b/main/tests/server/src/com/google/refine/expr/functions/LengthTests.java index 74addbbc3..403bb0afd 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/LengthTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/LengthTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions; import org.testng.annotations.Test; -import com.google.refine.expr.functions.Length; import com.google.refine.util.TestUtils; public class LengthTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/SliceTests.java b/main/tests/server/src/com/google/refine/expr/functions/SliceTests.java index f47c06ad5..a40082459 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/SliceTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/SliceTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions; import org.testng.annotations.Test; -import com.google.refine.expr.functions.Slice; import com.google.refine.util.TestUtils; public class SliceTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/arrays/JoinTests.java b/main/tests/server/src/com/google/refine/expr/functions/arrays/JoinTests.java index 18d7eb100..dc06c9b25 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/arrays/JoinTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/arrays/JoinTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.arrays; import org.testng.annotations.Test; -import com.google.refine.expr.functions.arrays.Join; import com.google.refine.util.TestUtils; public class JoinTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/arrays/ReverseTests.java b/main/tests/server/src/com/google/refine/expr/functions/arrays/ReverseTests.java index 9d2a3449a..283ad34ca 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/arrays/ReverseTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/arrays/ReverseTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.arrays; import org.testng.annotations.Test; -import com.google.refine.expr.functions.arrays.Reverse; import com.google.refine.util.TestUtils; public class ReverseTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/arrays/SortTests.java b/main/tests/server/src/com/google/refine/expr/functions/arrays/SortTests.java index b9a3b3067..561f84fb1 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/arrays/SortTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/arrays/SortTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.arrays; import org.testng.annotations.Test; -import com.google.refine.expr.functions.arrays.Sort; import com.google.refine.util.TestUtils; public class SortTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/arrays/UniquesTests.java b/main/tests/server/src/com/google/refine/expr/functions/arrays/UniquesTests.java index 5ef2567dc..ca85c6e37 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/arrays/UniquesTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/arrays/UniquesTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.arrays; import org.testng.annotations.Test; -import com.google.refine.expr.functions.arrays.Uniques; import com.google.refine.util.TestUtils; public class UniquesTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/booleans/AndTests.java b/main/tests/server/src/com/google/refine/expr/functions/booleans/AndTests.java index 4ddb31c97..7f0c6263f 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/booleans/AndTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/booleans/AndTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.booleans; import org.testng.annotations.Test; -import com.google.refine.expr.functions.booleans.And; import com.google.refine.util.TestUtils; public class AndTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/booleans/NotTests.java b/main/tests/server/src/com/google/refine/expr/functions/booleans/NotTests.java index 188edd7cc..dbdb7902e 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/booleans/NotTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/booleans/NotTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.booleans; import org.testng.annotations.Test; -import com.google.refine.expr.functions.booleans.Not; import com.google.refine.util.TestUtils; public class NotTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/booleans/OrTests.java b/main/tests/server/src/com/google/refine/expr/functions/booleans/OrTests.java index a1e4a2ee1..76889cf6b 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/booleans/OrTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/booleans/OrTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.booleans; import org.testng.annotations.Test; -import com.google.refine.expr.functions.booleans.Or; import com.google.refine.util.TestUtils; public class OrTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/booleans/XorTests.java b/main/tests/server/src/com/google/refine/expr/functions/booleans/XorTests.java index f58982162..a4a619b74 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/booleans/XorTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/booleans/XorTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.booleans; import org.testng.annotations.Test; -import com.google.refine.expr.functions.booleans.Xor; import com.google.refine.util.TestUtils; public class XorTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/html/InnerHtmlTests.java b/main/tests/server/src/com/google/refine/expr/functions/html/InnerHtmlTests.java index 7396b0ed4..57ae1f3af 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/html/InnerHtmlTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/html/InnerHtmlTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.html; import org.testng.annotations.Test; -import com.google.refine.expr.functions.html.InnerHtml; import com.google.refine.util.TestUtils; public class InnerHtmlTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/ACosTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/ACosTests.java index cc21967af..1ea601135 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/ACosTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/ACosTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.ACos; import com.google.refine.util.TestUtils; public class ACosTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/ASinTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/ASinTests.java index 65e39c948..844ba1e74 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/ASinTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/ASinTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.ASin; import com.google.refine.util.TestUtils; public class ASinTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/ATan2Tests.java b/main/tests/server/src/com/google/refine/expr/functions/math/ATan2Tests.java index d51cd7ac0..4e1bcda98 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/ATan2Tests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/ATan2Tests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.ATan2; import com.google.refine.util.TestUtils; public class ATan2Tests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/ATanTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/ATanTests.java index f837750b4..805340dbb 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/ATanTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/ATanTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.ATan; import com.google.refine.util.TestUtils; public class ATanTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/AbsTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/AbsTests.java index 139704a4b..e84452c04 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/AbsTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/AbsTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.Abs; import com.google.refine.util.TestUtils; public class AbsTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/CeilTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/CeilTests.java index 8018bdad6..03083533a 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/CeilTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/CeilTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.Ceil; import com.google.refine.util.TestUtils; public class CeilTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/CombinTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/CombinTests.java index faff49abe..3f63d3e91 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/CombinTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/CombinTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.Combin; import com.google.refine.util.TestUtils; public class CombinTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/CosTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/CosTests.java index 5399d5c24..c1e8702d1 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/CosTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/CosTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.Cos; import com.google.refine.util.TestUtils; public class CosTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/CoshTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/CoshTests.java index f0eb2a59b..b34541ec4 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/CoshTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/CoshTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.Cosh; import com.google.refine.util.TestUtils; public class CoshTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/DegreesTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/DegreesTests.java index cb3566de5..0f27c7dc9 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/DegreesTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/DegreesTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.Degrees; import com.google.refine.util.TestUtils; public class DegreesTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/EvenTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/EvenTests.java index c37d83bc4..7e801e1fc 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/EvenTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/EvenTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.Even; import com.google.refine.util.TestUtils; public class EvenTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/ExpTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/ExpTests.java index 49bff32aa..a570613ef 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/ExpTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/ExpTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.Exp; import com.google.refine.util.TestUtils; public class ExpTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/FactNTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/FactNTests.java index dfc978c0a..431d2317b 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/FactNTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/FactNTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.FactN; import com.google.refine.util.TestUtils; public class FactNTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/FactTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/FactTests.java index 2bda56195..5758a071b 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/FactTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/FactTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.Fact; import com.google.refine.util.TestUtils; public class FactTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/FloorTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/FloorTests.java index cb40b4908..b5d813e5b 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/FloorTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/FloorTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.Floor; import com.google.refine.util.TestUtils; public class FloorTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/GreatestCommonDenominatorTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/GreatestCommonDenominatorTests.java index cba5f3ea6..eb8d4dcc6 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/GreatestCommonDenominatorTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/GreatestCommonDenominatorTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.GreatestCommonDenominator; import com.google.refine.util.TestUtils; public class GreatestCommonDenominatorTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/LeastCommonMultipleTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/LeastCommonMultipleTests.java index b8c68842d..88b27943d 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/LeastCommonMultipleTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/LeastCommonMultipleTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.LeastCommonMultiple; import com.google.refine.util.TestUtils; public class LeastCommonMultipleTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/LnTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/LnTests.java index 6b04f27f4..2c318a4ab 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/LnTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/LnTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.Ln; import com.google.refine.util.TestUtils; public class LnTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/LogTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/LogTests.java index 90d42d404..6d8da50aa 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/LogTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/LogTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.Log; import com.google.refine.util.TestUtils; public class LogTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/MaxTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/MaxTests.java index 07a9cec15..591bdc560 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/MaxTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/MaxTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.Max; import com.google.refine.util.TestUtils; public class MaxTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/MinTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/MinTests.java index 344b3bca0..d38dc8560 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/MinTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/MinTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.Min; import com.google.refine.util.TestUtils; public class MinTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/ModTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/ModTests.java index 5c4118d96..3a3b8b3cd 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/ModTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/ModTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.Mod; import com.google.refine.util.TestUtils; public class ModTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/MultinomialTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/MultinomialTests.java index 454dad36e..68ecb8101 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/MultinomialTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/MultinomialTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.Multinomial; import com.google.refine.util.TestUtils; public class MultinomialTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/OddTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/OddTests.java index 2202454d7..f61d200e1 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/OddTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/OddTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.Odd; import com.google.refine.util.TestUtils; public class OddTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/PowTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/PowTests.java index 78b53724f..3523fcf94 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/PowTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/PowTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.Pow; import com.google.refine.util.TestUtils; public class PowTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/QuotientTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/QuotientTests.java index 91c7ede2e..e3c288d70 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/QuotientTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/QuotientTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.Quotient; import com.google.refine.util.TestUtils; public class QuotientTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/RadiansTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/RadiansTests.java index 6176c7344..2ecc3dec1 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/RadiansTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/RadiansTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.Radians; import com.google.refine.util.TestUtils; public class RadiansTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/RoundTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/RoundTests.java index ce2a5e83e..330baa93e 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/RoundTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/RoundTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.Round; import com.google.refine.util.TestUtils; public class RoundTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/SinTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/SinTests.java index adb836578..c3ed18c21 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/SinTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/SinTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.Sin; import com.google.refine.util.TestUtils; public class SinTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/SinhTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/SinhTests.java index e60ede850..bb9c09d4d 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/SinhTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/SinhTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.Sinh; import com.google.refine.util.TestUtils; public class SinhTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/SumTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/SumTests.java index 16f26d411..1003bb313 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/SumTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/SumTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.Sum; import com.google.refine.util.TestUtils; public class SumTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/TanTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/TanTests.java index 44bf54c92..99f1b8c15 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/TanTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/TanTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.Tan; import com.google.refine.util.TestUtils; public class TanTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/math/TanhTests.java b/main/tests/server/src/com/google/refine/expr/functions/math/TanhTests.java index 3c622afda..a2d175398 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/math/TanhTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/math/TanhTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.math; import org.testng.annotations.Test; -import com.google.refine.expr.functions.math.Tanh; import com.google.refine.util.TestUtils; public class TanhTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/ChompTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/ChompTests.java index ea1d47248..1c628ae54 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/ChompTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/ChompTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.strings; import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.Chomp; import com.google.refine.util.TestUtils; public class ChompTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/EndsWithTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/EndsWithTests.java index a8e55b11c..9c59b6d56 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/EndsWithTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/EndsWithTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.strings; import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.EndsWith; import com.google.refine.util.TestUtils; public class EndsWithTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/IndexOfTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/IndexOfTests.java index e430d63ad..63bbaf332 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/IndexOfTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/IndexOfTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.strings; import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.IndexOf; import com.google.refine.util.TestUtils; public class IndexOfTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/LastIndexOfTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/LastIndexOfTests.java index ce4afab09..81bbf308b 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/LastIndexOfTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/LastIndexOfTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.strings; import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.LastIndexOf; import com.google.refine.util.TestUtils; public class LastIndexOfTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/MD5Tests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/MD5Tests.java index 0cb549b63..73ce3bb7e 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/MD5Tests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/MD5Tests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.strings; import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.MD5; import com.google.refine.util.TestUtils; public class MD5Tests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/MatchTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/MatchTests.java index 482211175..660a0515f 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/MatchTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/MatchTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.strings; import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.Match; import com.google.refine.util.TestUtils; public class MatchTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/NGramFingerprintTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/NGramFingerprintTests.java index 5aca5981c..1703aae88 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/NGramFingerprintTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/NGramFingerprintTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.strings; import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.NGramFingerprint; import com.google.refine.util.TestUtils; public class NGramFingerprintTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/NGramTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/NGramTests.java index 8d9d31230..bc1190749 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/NGramTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/NGramTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.strings; import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.NGram; import com.google.refine.util.TestUtils; public class NGramTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/ParseJsonTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/ParseJsonTests.java index f33d80626..16a6a7ae2 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/ParseJsonTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/ParseJsonTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.strings; import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.ParseJson; import com.google.refine.util.TestUtils; public class ParseJsonTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/PartitionTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/PartitionTests.java index ee1e54845..005f0d408 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/PartitionTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/PartitionTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.strings; import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.Partition; import com.google.refine.util.TestUtils; public class PartitionTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/PhoneticTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/PhoneticTests.java index ed2e946c2..de4aa0505 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/PhoneticTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/PhoneticTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.strings; import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.Phonetic; import com.google.refine.util.TestUtils; public class PhoneticTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/RPartitionTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/RPartitionTests.java index ce9342182..4baba0428 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/RPartitionTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/RPartitionTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.strings; import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.RPartition; import com.google.refine.util.TestUtils; public class RPartitionTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/ReinterpretTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/ReinterpretTests.java index 7208430b0..e40107cb1 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/ReinterpretTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/ReinterpretTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.strings; import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.Reinterpret; import com.google.refine.util.TestUtils; public class ReinterpretTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/ReplaceCharsTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/ReplaceCharsTests.java index 7a516182a..b43f883ad 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/ReplaceCharsTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/ReplaceCharsTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.strings; import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.ReplaceChars; import com.google.refine.util.TestUtils; public class ReplaceCharsTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/ReplaceTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/ReplaceTests.java index 6df43eb3c..09b4158bc 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/ReplaceTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/ReplaceTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.strings; import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.Replace; import com.google.refine.util.TestUtils; public class ReplaceTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/SHA1Tests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/SHA1Tests.java index a6e900a50..98c5cb478 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/SHA1Tests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/SHA1Tests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.strings; import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.SHA1; import com.google.refine.util.TestUtils; public class SHA1Tests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/SplitByCharTypeTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/SplitByCharTypeTests.java index 096a8a4fc..0037c1bed 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/SplitByCharTypeTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/SplitByCharTypeTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.strings; import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.SplitByCharType; import com.google.refine.util.TestUtils; public class SplitByCharTypeTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/SplitByLengthsTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/SplitByLengthsTests.java index b5e57c342..026ef05a8 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/SplitByLengthsTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/SplitByLengthsTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.strings; import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.SplitByLengths; import com.google.refine.util.TestUtils; public class SplitByLengthsTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/SplitTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/SplitTests.java index 61222615c..a4ad884bb 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/SplitTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/SplitTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.strings; import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.Split; import com.google.refine.util.TestUtils; public class SplitTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/StartsWithTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/StartsWithTests.java index 8b565d382..37a7335c5 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/StartsWithTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/StartsWithTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.strings; import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.StartsWith; import com.google.refine.util.TestUtils; public class StartsWithTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/ToLowercaseTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/ToLowercaseTests.java index 01e3b803f..bb2594ce3 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/ToLowercaseTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/ToLowercaseTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.strings; import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.ToLowercase; import com.google.refine.util.TestUtils; public class ToLowercaseTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/UnicodeTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/UnicodeTests.java index fca0b5be7..c01ca25df 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/UnicodeTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/UnicodeTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.strings; import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.Unicode; import com.google.refine.util.TestUtils; public class UnicodeTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/UnicodeTypeTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/UnicodeTypeTests.java index dedde5726..dd6a6c4c2 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/UnicodeTypeTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/UnicodeTypeTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.strings; import org.testng.annotations.Test; -import com.google.refine.expr.functions.strings.UnicodeType; import com.google.refine.util.TestUtils; public class UnicodeTypeTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/xml/InnerXmlTests.java b/main/tests/server/src/com/google/refine/expr/functions/xml/InnerXmlTests.java index 06fcec51b..5f14b967e 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/xml/InnerXmlTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/xml/InnerXmlTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.xml; import org.testng.annotations.Test; -import com.google.refine.expr.functions.xml.InnerXml; import com.google.refine.util.TestUtils; public class InnerXmlTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/xml/OwnTextTests.java b/main/tests/server/src/com/google/refine/expr/functions/xml/OwnTextTests.java index 65fa19892..64e0f6b4a 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/xml/OwnTextTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/xml/OwnTextTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.xml; import org.testng.annotations.Test; -import com.google.refine.expr.functions.xml.OwnText; import com.google.refine.util.TestUtils; public class OwnTextTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/xml/SelectXmlTests.java b/main/tests/server/src/com/google/refine/expr/functions/xml/SelectXmlTests.java index 9f23851b3..a68e92d77 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/xml/SelectXmlTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/xml/SelectXmlTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.xml; import org.testng.annotations.Test; -import com.google.refine.expr.functions.xml.SelectXml; import com.google.refine.util.TestUtils; public class SelectXmlTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/xml/xmlAttrTests.java b/main/tests/server/src/com/google/refine/expr/functions/xml/xmlAttrTests.java index a339a9b3f..5a38d18c3 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/xml/xmlAttrTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/xml/xmlAttrTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.xml; import org.testng.annotations.Test; -import com.google.refine.expr.functions.xml.XmlAttr; import com.google.refine.util.TestUtils; public class xmlAttrTests { diff --git a/main/tests/server/src/com/google/refine/expr/functions/xml/xmlTextTests.java b/main/tests/server/src/com/google/refine/expr/functions/xml/xmlTextTests.java index 478a34c93..41bef9444 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/xml/xmlTextTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/xml/xmlTextTests.java @@ -28,7 +28,6 @@ package com.google.refine.expr.functions.xml; import org.testng.annotations.Test; -import com.google.refine.expr.functions.xml.XmlText; import com.google.refine.util.TestUtils; public class xmlTextTests { diff --git a/main/tests/server/src/com/google/refine/grel/ast/LiteralExprTest.java b/main/tests/server/src/com/google/refine/grel/ast/LiteralExprTest.java index e182c899e..16b55699c 100644 --- a/main/tests/server/src/com/google/refine/grel/ast/LiteralExprTest.java +++ b/main/tests/server/src/com/google/refine/grel/ast/LiteralExprTest.java @@ -30,8 +30,6 @@ import static org.testng.Assert.assertEquals; import org.testng.annotations.Test; -import com.google.refine.grel.ast.LiteralExpr; - public class LiteralExprTest { @Test public void intLiteralToString() { diff --git a/main/tests/server/src/com/google/refine/grel/controls/FilterTests.java b/main/tests/server/src/com/google/refine/grel/controls/FilterTests.java index 297366654..ef7901f55 100644 --- a/main/tests/server/src/com/google/refine/grel/controls/FilterTests.java +++ b/main/tests/server/src/com/google/refine/grel/controls/FilterTests.java @@ -28,7 +28,6 @@ package com.google.refine.grel.controls; import org.testng.annotations.Test; -import com.google.refine.grel.controls.Filter; import com.google.refine.util.TestUtils; public class FilterTests { diff --git a/main/tests/server/src/com/google/refine/grel/controls/ForEachIndexTests.java b/main/tests/server/src/com/google/refine/grel/controls/ForEachIndexTests.java index ece39d091..bd11af612 100644 --- a/main/tests/server/src/com/google/refine/grel/controls/ForEachIndexTests.java +++ b/main/tests/server/src/com/google/refine/grel/controls/ForEachIndexTests.java @@ -28,7 +28,6 @@ package com.google.refine.grel.controls; import org.testng.annotations.Test; -import com.google.refine.grel.controls.ForEachIndex; import com.google.refine.util.TestUtils; public class ForEachIndexTests { diff --git a/main/tests/server/src/com/google/refine/grel/controls/ForEachTests.java b/main/tests/server/src/com/google/refine/grel/controls/ForEachTests.java index 939976ad8..ec1e30e6c 100644 --- a/main/tests/server/src/com/google/refine/grel/controls/ForEachTests.java +++ b/main/tests/server/src/com/google/refine/grel/controls/ForEachTests.java @@ -28,7 +28,6 @@ package com.google.refine.grel.controls; import org.testng.annotations.Test; -import com.google.refine.grel.controls.ForEach; import com.google.refine.util.TestUtils; public class ForEachTests { diff --git a/main/tests/server/src/com/google/refine/grel/controls/ForNonBlankTests.java b/main/tests/server/src/com/google/refine/grel/controls/ForNonBlankTests.java index f71397335..4cfd196d0 100644 --- a/main/tests/server/src/com/google/refine/grel/controls/ForNonBlankTests.java +++ b/main/tests/server/src/com/google/refine/grel/controls/ForNonBlankTests.java @@ -28,7 +28,6 @@ package com.google.refine.grel.controls; import org.testng.annotations.Test; -import com.google.refine.grel.controls.ForNonBlank; import com.google.refine.util.TestUtils; public class ForNonBlankTests { diff --git a/main/tests/server/src/com/google/refine/grel/controls/ForRangeTests.java b/main/tests/server/src/com/google/refine/grel/controls/ForRangeTests.java index 33f1d67ac..ed0867b5b 100644 --- a/main/tests/server/src/com/google/refine/grel/controls/ForRangeTests.java +++ b/main/tests/server/src/com/google/refine/grel/controls/ForRangeTests.java @@ -28,7 +28,6 @@ package com.google.refine.grel.controls; import org.testng.annotations.Test; -import com.google.refine.grel.controls.ForRange; import com.google.refine.util.TestUtils; public class ForRangeTests { diff --git a/main/tests/server/src/com/google/refine/grel/controls/IfTests.java b/main/tests/server/src/com/google/refine/grel/controls/IfTests.java index 76bc10a90..6c4c4a3db 100644 --- a/main/tests/server/src/com/google/refine/grel/controls/IfTests.java +++ b/main/tests/server/src/com/google/refine/grel/controls/IfTests.java @@ -28,7 +28,6 @@ package com.google.refine.grel.controls; import org.testng.annotations.Test; -import com.google.refine.grel.controls.If; import com.google.refine.util.TestUtils; public class IfTests { diff --git a/main/tests/server/src/com/google/refine/grel/controls/IsBlankTests.java b/main/tests/server/src/com/google/refine/grel/controls/IsBlankTests.java index c0089404d..eed0fbb96 100644 --- a/main/tests/server/src/com/google/refine/grel/controls/IsBlankTests.java +++ b/main/tests/server/src/com/google/refine/grel/controls/IsBlankTests.java @@ -28,7 +28,6 @@ package com.google.refine.grel.controls; import org.testng.annotations.Test; -import com.google.refine.grel.controls.IsBlank; import com.google.refine.util.TestUtils; public class IsBlankTests { diff --git a/main/tests/server/src/com/google/refine/grel/controls/IsEmptyStringTests.java b/main/tests/server/src/com/google/refine/grel/controls/IsEmptyStringTests.java index 97436d694..27f57605b 100644 --- a/main/tests/server/src/com/google/refine/grel/controls/IsEmptyStringTests.java +++ b/main/tests/server/src/com/google/refine/grel/controls/IsEmptyStringTests.java @@ -28,7 +28,6 @@ package com.google.refine.grel.controls; import org.testng.annotations.Test; -import com.google.refine.grel.controls.IsEmptyString; import com.google.refine.util.TestUtils; public class IsEmptyStringTests { diff --git a/main/tests/server/src/com/google/refine/grel/controls/IsErrorTests.java b/main/tests/server/src/com/google/refine/grel/controls/IsErrorTests.java index 15c5da63c..8d760a452 100644 --- a/main/tests/server/src/com/google/refine/grel/controls/IsErrorTests.java +++ b/main/tests/server/src/com/google/refine/grel/controls/IsErrorTests.java @@ -28,7 +28,6 @@ package com.google.refine.grel.controls; import org.testng.annotations.Test; -import com.google.refine.grel.controls.IsError; import com.google.refine.util.TestUtils; public class IsErrorTests { diff --git a/main/tests/server/src/com/google/refine/grel/controls/IsNonBlankTests.java b/main/tests/server/src/com/google/refine/grel/controls/IsNonBlankTests.java index e0a820c46..fffc039f4 100644 --- a/main/tests/server/src/com/google/refine/grel/controls/IsNonBlankTests.java +++ b/main/tests/server/src/com/google/refine/grel/controls/IsNonBlankTests.java @@ -28,7 +28,6 @@ package com.google.refine.grel.controls; import org.testng.annotations.Test; -import com.google.refine.grel.controls.IsNonBlank; import com.google.refine.util.TestUtils; public class IsNonBlankTests { diff --git a/main/tests/server/src/com/google/refine/grel/controls/IsNotNullTests.java b/main/tests/server/src/com/google/refine/grel/controls/IsNotNullTests.java index 3c24031c5..f1d45d1af 100644 --- a/main/tests/server/src/com/google/refine/grel/controls/IsNotNullTests.java +++ b/main/tests/server/src/com/google/refine/grel/controls/IsNotNullTests.java @@ -28,7 +28,6 @@ package com.google.refine.grel.controls; import org.testng.annotations.Test; -import com.google.refine.grel.controls.IsNotNull; import com.google.refine.util.TestUtils; public class IsNotNullTests { diff --git a/main/tests/server/src/com/google/refine/grel/controls/IsNullTests.java b/main/tests/server/src/com/google/refine/grel/controls/IsNullTests.java index 059be4fbd..7f827a504 100644 --- a/main/tests/server/src/com/google/refine/grel/controls/IsNullTests.java +++ b/main/tests/server/src/com/google/refine/grel/controls/IsNullTests.java @@ -28,7 +28,6 @@ package com.google.refine.grel.controls; import org.testng.annotations.Test; -import com.google.refine.grel.controls.IsNull; import com.google.refine.util.TestUtils; public class IsNullTests { diff --git a/main/tests/server/src/com/google/refine/grel/controls/IsNumericTests.java b/main/tests/server/src/com/google/refine/grel/controls/IsNumericTests.java index b1236d658..f15397258 100644 --- a/main/tests/server/src/com/google/refine/grel/controls/IsNumericTests.java +++ b/main/tests/server/src/com/google/refine/grel/controls/IsNumericTests.java @@ -28,7 +28,6 @@ package com.google.refine.grel.controls; import org.testng.annotations.Test; -import com.google.refine.grel.controls.IsNumeric; import com.google.refine.util.TestUtils; public class IsNumericTests { diff --git a/main/tests/server/src/com/google/refine/grel/controls/WithTests.java b/main/tests/server/src/com/google/refine/grel/controls/WithTests.java index 4baf60825..82f24a3d6 100644 --- a/main/tests/server/src/com/google/refine/grel/controls/WithTests.java +++ b/main/tests/server/src/com/google/refine/grel/controls/WithTests.java @@ -28,7 +28,6 @@ package com.google.refine.grel.controls; import org.testng.annotations.Test; -import com.google.refine.grel.controls.With; import com.google.refine.util.TestUtils; public class WithTests { diff --git a/main/tests/server/src/com/google/refine/history/FileHistoryEntryManagerTests.java b/main/tests/server/src/com/google/refine/history/FileHistoryEntryManagerTests.java index f08523388..65c842f4b 100644 --- a/main/tests/server/src/com/google/refine/history/FileHistoryEntryManagerTests.java +++ b/main/tests/server/src/com/google/refine/history/FileHistoryEntryManagerTests.java @@ -10,7 +10,6 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import com.google.refine.RefineTest; -import com.google.refine.history.HistoryEntry; import com.google.refine.io.FileHistoryEntryManager; import com.google.refine.model.Project; import com.google.refine.operations.OperationRegistry; diff --git a/main/tests/server/src/com/google/refine/history/HistoryEntryTests.java b/main/tests/server/src/com/google/refine/history/HistoryEntryTests.java index 131208f4b..73eaf8cb8 100644 --- a/main/tests/server/src/com/google/refine/history/HistoryEntryTests.java +++ b/main/tests/server/src/com/google/refine/history/HistoryEntryTests.java @@ -35,7 +35,6 @@ import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import com.google.refine.RefineTest; -import com.google.refine.history.HistoryEntry; import com.google.refine.model.Project; import com.google.refine.operations.OperationRegistry; import com.google.refine.operations.column.ColumnAdditionOperation; diff --git a/main/tests/server/src/com/google/refine/history/HistoryTests.java b/main/tests/server/src/com/google/refine/history/HistoryTests.java index 18acdb0df..10a91e6ba 100644 --- a/main/tests/server/src/com/google/refine/history/HistoryTests.java +++ b/main/tests/server/src/com/google/refine/history/HistoryTests.java @@ -47,12 +47,8 @@ import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import com.google.refine.ProjectManager; -import com.google.refine.history.Change; import com.google.refine.ProjectMetadata; import com.google.refine.RefineTest; -import com.google.refine.history.History; -import com.google.refine.history.HistoryEntry; -import com.google.refine.history.HistoryEntryManager; import com.google.refine.model.Project; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/importers/ImporterUtilitiesTests.java b/main/tests/server/src/com/google/refine/importers/ImporterUtilitiesTests.java index 1bdfc941c..01ae486cf 100644 --- a/main/tests/server/src/com/google/refine/importers/ImporterUtilitiesTests.java +++ b/main/tests/server/src/com/google/refine/importers/ImporterUtilitiesTests.java @@ -48,7 +48,6 @@ import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import com.google.refine.RefineTest; -import com.google.refine.importers.ImporterUtilities; import com.google.refine.model.Cell; import com.google.refine.model.Project; import com.google.refine.model.Row; diff --git a/main/tests/server/src/com/google/refine/importers/WikitextImporterTests.java b/main/tests/server/src/com/google/refine/importers/WikitextImporterTests.java index 094b91277..b6b10a0a5 100644 --- a/main/tests/server/src/com/google/refine/importers/WikitextImporterTests.java +++ b/main/tests/server/src/com/google/refine/importers/WikitextImporterTests.java @@ -45,7 +45,6 @@ import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.AfterMethod; @@ -58,7 +57,7 @@ import com.google.refine.model.ReconCandidate; import com.google.refine.model.recon.ReconJob; import com.google.refine.model.recon.StandardReconConfig; -@PrepareForTest(WikitextImporter.class) + public class WikitextImporterTests extends ImporterTest { private WikitextImporter importer = null; diff --git a/main/tests/server/src/com/google/refine/io/FileProjectManagerTests.java b/main/tests/server/src/com/google/refine/io/FileProjectManagerTests.java index 367f26d30..af89c4f0c 100644 --- a/main/tests/server/src/com/google/refine/io/FileProjectManagerTests.java +++ b/main/tests/server/src/com/google/refine/io/FileProjectManagerTests.java @@ -35,7 +35,6 @@ import java.io.IOException; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import com.google.refine.io.FileProjectManager; import com.google.refine.util.TestUtils; import com.google.refine.ProjectMetadata; diff --git a/main/tests/server/src/com/google/refine/model/CacheTests.java b/main/tests/server/src/com/google/refine/model/CacheTests.java index 7e11492c7..9996815be 100644 --- a/main/tests/server/src/com/google/refine/model/CacheTests.java +++ b/main/tests/server/src/com/google/refine/model/CacheTests.java @@ -32,6 +32,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.google.refine.model; + import java.io.IOException; import java.util.Properties; @@ -48,10 +49,6 @@ import com.google.refine.browsing.EngineConfig; import com.google.refine.browsing.RowVisitor; import com.google.refine.expr.functions.FacetCount; import com.google.refine.grel.Function; -import com.google.refine.model.Cell; -import com.google.refine.model.ModelException; -import com.google.refine.model.Project; -import com.google.refine.model.Row; import com.google.refine.operations.EngineDependentOperation; import com.google.refine.operations.row.RowRemovalOperation; diff --git a/main/tests/server/src/com/google/refine/model/CellTests.java b/main/tests/server/src/com/google/refine/model/CellTests.java index 839b93635..26c9d0f5d 100644 --- a/main/tests/server/src/com/google/refine/model/CellTests.java +++ b/main/tests/server/src/com/google/refine/model/CellTests.java @@ -38,8 +38,6 @@ import static org.mockito.Mockito.when; import org.testng.annotations.Test; import com.google.refine.expr.EvalError; -import com.google.refine.model.Cell; -import com.google.refine.model.Recon; import com.google.refine.util.Pool; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/model/ColumnGroupTests.java b/main/tests/server/src/com/google/refine/model/ColumnGroupTests.java index 2814f3e18..a1ddf355b 100644 --- a/main/tests/server/src/com/google/refine/model/ColumnGroupTests.java +++ b/main/tests/server/src/com/google/refine/model/ColumnGroupTests.java @@ -28,7 +28,6 @@ package com.google.refine.model; import org.testng.annotations.Test; -import com.google.refine.model.ColumnGroup; import com.google.refine.util.TestUtils; public class ColumnGroupTests { diff --git a/main/tests/server/src/com/google/refine/model/ColumnModelTests.java b/main/tests/server/src/com/google/refine/model/ColumnModelTests.java index 15e91d9bc..24315fbc9 100644 --- a/main/tests/server/src/com/google/refine/model/ColumnModelTests.java +++ b/main/tests/server/src/com/google/refine/model/ColumnModelTests.java @@ -29,8 +29,6 @@ package com.google.refine.model; import org.testng.annotations.Test; import com.google.refine.RefineTest; -import com.google.refine.model.ColumnModel; -import com.google.refine.model.Project; import com.google.refine.util.TestUtils; public class ColumnModelTests extends RefineTest { diff --git a/main/tests/server/src/com/google/refine/model/ColumnTests.java b/main/tests/server/src/com/google/refine/model/ColumnTests.java index 4d2dab0f9..ae0c36089 100644 --- a/main/tests/server/src/com/google/refine/model/ColumnTests.java +++ b/main/tests/server/src/com/google/refine/model/ColumnTests.java @@ -31,7 +31,6 @@ import static org.mockito.Mockito.when; import org.testng.annotations.Test; -import com.google.refine.model.Column; import com.google.refine.model.recon.ReconConfig; import com.google.refine.model.recon.StandardReconConfig; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/model/ProjectStub.java b/main/tests/server/src/com/google/refine/model/ProjectStub.java index 4fc7149ac..59ad12eba 100644 --- a/main/tests/server/src/com/google/refine/model/ProjectStub.java +++ b/main/tests/server/src/com/google/refine/model/ProjectStub.java @@ -33,8 +33,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package com.google.refine.model; -import com.google.refine.model.Project; - public class ProjectStub extends Project { public ProjectStub(long id){ diff --git a/main/tests/server/src/com/google/refine/model/ReconCandidateTests.java b/main/tests/server/src/com/google/refine/model/ReconCandidateTests.java index 11af1f436..af9a9c3d2 100644 --- a/main/tests/server/src/com/google/refine/model/ReconCandidateTests.java +++ b/main/tests/server/src/com/google/refine/model/ReconCandidateTests.java @@ -28,7 +28,6 @@ package com.google.refine.model; import org.testng.annotations.Test; -import com.google.refine.model.ReconCandidate; import com.google.refine.util.TestUtils; public class ReconCandidateTests { diff --git a/main/tests/server/src/com/google/refine/model/ReconStatsTests.java b/main/tests/server/src/com/google/refine/model/ReconStatsTests.java index 3b1813047..a86efc3ba 100644 --- a/main/tests/server/src/com/google/refine/model/ReconStatsTests.java +++ b/main/tests/server/src/com/google/refine/model/ReconStatsTests.java @@ -28,7 +28,6 @@ package com.google.refine.model; import org.testng.annotations.Test; -import com.google.refine.model.ReconStats; import com.google.refine.util.TestUtils; public class ReconStatsTests { diff --git a/main/tests/server/src/com/google/refine/model/ReconTests.java b/main/tests/server/src/com/google/refine/model/ReconTests.java index 8a362a83b..ccf5c9b88 100644 --- a/main/tests/server/src/com/google/refine/model/ReconTests.java +++ b/main/tests/server/src/com/google/refine/model/ReconTests.java @@ -28,7 +28,6 @@ package com.google.refine.model; import org.testng.annotations.Test; -import com.google.refine.model.Recon; import com.google.refine.model.Recon.Judgment; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/model/ReconTypeTest.java b/main/tests/server/src/com/google/refine/model/ReconTypeTest.java index 8cad9af08..fccff93dd 100644 --- a/main/tests/server/src/com/google/refine/model/ReconTypeTest.java +++ b/main/tests/server/src/com/google/refine/model/ReconTypeTest.java @@ -31,7 +31,6 @@ import java.io.IOException; import org.testng.Assert; import org.testng.annotations.Test; -import com.google.refine.model.ReconType; import com.google.refine.util.TestUtils; public class ReconTypeTest { diff --git a/main/tests/server/src/com/google/refine/model/RecordModelTests.java b/main/tests/server/src/com/google/refine/model/RecordModelTests.java index 7d5fa78d6..b1af88718 100644 --- a/main/tests/server/src/com/google/refine/model/RecordModelTests.java +++ b/main/tests/server/src/com/google/refine/model/RecordModelTests.java @@ -29,7 +29,6 @@ package com.google.refine.model; import org.testng.annotations.Test; import com.google.refine.RefineTest; -import com.google.refine.model.Project; import com.google.refine.util.TestUtils; public class RecordModelTests extends RefineTest { diff --git a/main/tests/server/src/com/google/refine/model/RowTests.java b/main/tests/server/src/com/google/refine/model/RowTests.java index 88fae7f80..484d138a9 100644 --- a/main/tests/server/src/com/google/refine/model/RowTests.java +++ b/main/tests/server/src/com/google/refine/model/RowTests.java @@ -47,7 +47,6 @@ import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import com.google.refine.RefineTest; - import com.google.refine.util.Pool; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/model/changes/DataExtensionChangeTest.java b/main/tests/server/src/com/google/refine/model/changes/DataExtensionChangeTest.java index 02dbdeabb..135b4c198 100644 --- a/main/tests/server/src/com/google/refine/model/changes/DataExtensionChangeTest.java +++ b/main/tests/server/src/com/google/refine/model/changes/DataExtensionChangeTest.java @@ -42,7 +42,6 @@ import com.google.refine.RefineTest; import com.google.refine.history.Change; import com.google.refine.model.ModelException; import com.google.refine.model.Project; -import com.google.refine.model.changes.DataExtensionChange; import com.google.refine.util.Pool; diff --git a/main/tests/server/src/com/google/refine/model/changes/MassChangeTests.java b/main/tests/server/src/com/google/refine/model/changes/MassChangeTests.java index bc694fef5..337a290a8 100644 --- a/main/tests/server/src/com/google/refine/model/changes/MassChangeTests.java +++ b/main/tests/server/src/com/google/refine/model/changes/MassChangeTests.java @@ -41,9 +41,6 @@ import com.google.refine.RefineTest; import com.google.refine.history.Change; import com.google.refine.model.ModelException; import com.google.refine.model.Project; -import com.google.refine.model.changes.CellAtRow; -import com.google.refine.model.changes.ColumnAdditionChange; -import com.google.refine.model.changes.MassChange; public class MassChangeTests extends RefineTest { diff --git a/main/tests/server/src/com/google/refine/operations/cell/BlankDownTests.java b/main/tests/server/src/com/google/refine/operations/cell/BlankDownTests.java index 9ea49a413..c04ae5ae7 100644 --- a/main/tests/server/src/com/google/refine/operations/cell/BlankDownTests.java +++ b/main/tests/server/src/com/google/refine/operations/cell/BlankDownTests.java @@ -44,8 +44,6 @@ import com.google.refine.model.Column; import com.google.refine.model.Project; import com.google.refine.model.Row; import com.google.refine.operations.OperationRegistry; -import com.google.refine.operations.cell.BlankDownOperation; -import com.google.refine.operations.cell.FillDownOperation; import com.google.refine.process.Process; import com.google.refine.util.ParsingUtilities; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/operations/cell/FillDownTests.java b/main/tests/server/src/com/google/refine/operations/cell/FillDownTests.java index 095557a8c..2d12ff6a4 100644 --- a/main/tests/server/src/com/google/refine/operations/cell/FillDownTests.java +++ b/main/tests/server/src/com/google/refine/operations/cell/FillDownTests.java @@ -44,7 +44,6 @@ import com.google.refine.model.Column; import com.google.refine.model.Project; import com.google.refine.model.Row; import com.google.refine.operations.OperationRegistry; -import com.google.refine.operations.cell.FillDownOperation; import com.google.refine.process.Process; import com.google.refine.util.ParsingUtilities; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/operations/cell/JoinMultiValuedCellsTests.java b/main/tests/server/src/com/google/refine/operations/cell/JoinMultiValuedCellsTests.java index 214fe1bb1..54aff3f3e 100644 --- a/main/tests/server/src/com/google/refine/operations/cell/JoinMultiValuedCellsTests.java +++ b/main/tests/server/src/com/google/refine/operations/cell/JoinMultiValuedCellsTests.java @@ -46,7 +46,6 @@ import com.google.refine.RefineTest; import com.google.refine.model.AbstractOperation; import com.google.refine.model.Project; import com.google.refine.operations.OperationRegistry; -import com.google.refine.operations.cell.MultiValuedCellJoinOperation; import com.google.refine.process.Process; import com.google.refine.util.ParsingUtilities; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/operations/cell/MassOperationTests.java b/main/tests/server/src/com/google/refine/operations/cell/MassOperationTests.java index 830ffd22f..f29e52c2a 100644 --- a/main/tests/server/src/com/google/refine/operations/cell/MassOperationTests.java +++ b/main/tests/server/src/com/google/refine/operations/cell/MassOperationTests.java @@ -35,7 +35,6 @@ import org.testng.annotations.Test; import com.fasterxml.jackson.core.type.TypeReference; import com.google.refine.RefineTest; import com.google.refine.operations.OperationRegistry; -import com.google.refine.operations.cell.MassEditOperation; import com.google.refine.operations.cell.MassEditOperation.Edit; import com.google.refine.util.ParsingUtilities; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/operations/cell/SplitMultiValuedCellsTests.java b/main/tests/server/src/com/google/refine/operations/cell/SplitMultiValuedCellsTests.java index b269324c8..061fddea4 100644 --- a/main/tests/server/src/com/google/refine/operations/cell/SplitMultiValuedCellsTests.java +++ b/main/tests/server/src/com/google/refine/operations/cell/SplitMultiValuedCellsTests.java @@ -46,7 +46,6 @@ import com.google.refine.RefineTest; import com.google.refine.model.AbstractOperation; import com.google.refine.model.Project; import com.google.refine.operations.OperationRegistry; -import com.google.refine.operations.cell.MultiValuedCellSplitOperation; import com.google.refine.process.Process; import com.google.refine.util.ParsingUtilities; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/operations/cell/TransposeTests.java b/main/tests/server/src/com/google/refine/operations/cell/TransposeTests.java index 9f3fc072f..947972fe3 100644 --- a/main/tests/server/src/com/google/refine/operations/cell/TransposeTests.java +++ b/main/tests/server/src/com/google/refine/operations/cell/TransposeTests.java @@ -39,7 +39,6 @@ import org.testng.annotations.Test; import com.google.refine.RefineTest; import com.google.refine.operations.OperationRegistry; -import com.google.refine.operations.cell.TransposeRowsIntoColumnsOperation; import com.google.refine.util.ParsingUtilities; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/operations/column/ColumnAdditionByFetchingURLsOperationTests.java b/main/tests/server/src/com/google/refine/operations/column/ColumnAdditionByFetchingURLsOperationTests.java index cd09215e0..e5068af39 100644 --- a/main/tests/server/src/com/google/refine/operations/column/ColumnAdditionByFetchingURLsOperationTests.java +++ b/main/tests/server/src/com/google/refine/operations/column/ColumnAdditionByFetchingURLsOperationTests.java @@ -56,7 +56,6 @@ import com.google.refine.model.Row; import com.google.refine.operations.EngineDependentOperation; import com.google.refine.operations.OnError; import com.google.refine.operations.OperationRegistry; -import com.google.refine.operations.column.ColumnAdditionByFetchingURLsOperation; import com.google.refine.operations.column.ColumnAdditionByFetchingURLsOperation.HttpHeader; import com.google.refine.process.Process; import com.google.refine.process.ProcessManager; diff --git a/main/tests/server/src/com/google/refine/operations/column/ColumnAdditionOperationTests.java b/main/tests/server/src/com/google/refine/operations/column/ColumnAdditionOperationTests.java index d3845ca7e..d4890945f 100644 --- a/main/tests/server/src/com/google/refine/operations/column/ColumnAdditionOperationTests.java +++ b/main/tests/server/src/com/google/refine/operations/column/ColumnAdditionOperationTests.java @@ -31,7 +31,6 @@ import org.testng.annotations.Test; import com.google.refine.RefineTest; import com.google.refine.operations.OperationRegistry; -import com.google.refine.operations.column.ColumnAdditionOperation; import com.google.refine.util.ParsingUtilities; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/operations/column/ColumnMoveOperationTests.java b/main/tests/server/src/com/google/refine/operations/column/ColumnMoveOperationTests.java index 4d9072044..ec78aa25a 100644 --- a/main/tests/server/src/com/google/refine/operations/column/ColumnMoveOperationTests.java +++ b/main/tests/server/src/com/google/refine/operations/column/ColumnMoveOperationTests.java @@ -31,7 +31,6 @@ import org.testng.annotations.Test; import com.google.refine.RefineTest; import com.google.refine.operations.OperationRegistry; -import com.google.refine.operations.column.ColumnMoveOperation; import com.google.refine.util.ParsingUtilities; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/operations/column/ColumnRemovalOperationTests.java b/main/tests/server/src/com/google/refine/operations/column/ColumnRemovalOperationTests.java index 41f971a9c..8e2d6e1be 100644 --- a/main/tests/server/src/com/google/refine/operations/column/ColumnRemovalOperationTests.java +++ b/main/tests/server/src/com/google/refine/operations/column/ColumnRemovalOperationTests.java @@ -31,7 +31,6 @@ import org.testng.annotations.Test; import com.google.refine.RefineTest; import com.google.refine.operations.OperationRegistry; -import com.google.refine.operations.column.ColumnRemovalOperation; import com.google.refine.util.ParsingUtilities; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/operations/column/ColumnRenameOperationTests.java b/main/tests/server/src/com/google/refine/operations/column/ColumnRenameOperationTests.java index f613062d0..27cbed72e 100644 --- a/main/tests/server/src/com/google/refine/operations/column/ColumnRenameOperationTests.java +++ b/main/tests/server/src/com/google/refine/operations/column/ColumnRenameOperationTests.java @@ -32,7 +32,6 @@ import org.testng.annotations.Test; import com.google.refine.RefineTest; import com.google.refine.model.AbstractOperation; import com.google.refine.operations.OperationRegistry; -import com.google.refine.operations.column.ColumnRenameOperation; import com.google.refine.util.ParsingUtilities; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/operations/column/ColumnReorderOperationTests.java b/main/tests/server/src/com/google/refine/operations/column/ColumnReorderOperationTests.java index 77c6ca440..58b9ff785 100644 --- a/main/tests/server/src/com/google/refine/operations/column/ColumnReorderOperationTests.java +++ b/main/tests/server/src/com/google/refine/operations/column/ColumnReorderOperationTests.java @@ -38,7 +38,6 @@ import com.google.refine.RefineTest; import com.google.refine.model.AbstractOperation; import com.google.refine.model.Project; import com.google.refine.operations.OperationRegistry; -import com.google.refine.operations.column.ColumnReorderOperation; import com.google.refine.process.Process; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/operations/column/ColumnSplitOperationTests.java b/main/tests/server/src/com/google/refine/operations/column/ColumnSplitOperationTests.java index 28b2e0f7c..632bc4848 100644 --- a/main/tests/server/src/com/google/refine/operations/column/ColumnSplitOperationTests.java +++ b/main/tests/server/src/com/google/refine/operations/column/ColumnSplitOperationTests.java @@ -31,7 +31,6 @@ import org.testng.annotations.Test; import com.google.refine.RefineTest; import com.google.refine.operations.OperationRegistry; -import com.google.refine.operations.column.ColumnSplitOperation; import com.google.refine.util.ParsingUtilities; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/operations/row/DenormalizeOperationTests.java b/main/tests/server/src/com/google/refine/operations/row/DenormalizeOperationTests.java index b1448e691..532364381 100644 --- a/main/tests/server/src/com/google/refine/operations/row/DenormalizeOperationTests.java +++ b/main/tests/server/src/com/google/refine/operations/row/DenormalizeOperationTests.java @@ -31,7 +31,6 @@ import org.testng.annotations.Test; import com.google.refine.RefineTest; import com.google.refine.operations.OperationRegistry; -import com.google.refine.operations.row.DenormalizeOperation; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/operations/row/RowFlagOperationTests.java b/main/tests/server/src/com/google/refine/operations/row/RowFlagOperationTests.java index 9e567e938..c0ef74353 100644 --- a/main/tests/server/src/com/google/refine/operations/row/RowFlagOperationTests.java +++ b/main/tests/server/src/com/google/refine/operations/row/RowFlagOperationTests.java @@ -31,7 +31,6 @@ import org.testng.annotations.Test; import com.google.refine.RefineTest; import com.google.refine.operations.OperationRegistry; -import com.google.refine.operations.row.RowFlagOperation; import com.google.refine.util.ParsingUtilities; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/operations/row/RowRemovalOperationTests.java b/main/tests/server/src/com/google/refine/operations/row/RowRemovalOperationTests.java index 3a2eb4f50..6e14fa666 100644 --- a/main/tests/server/src/com/google/refine/operations/row/RowRemovalOperationTests.java +++ b/main/tests/server/src/com/google/refine/operations/row/RowRemovalOperationTests.java @@ -33,7 +33,6 @@ import org.testng.annotations.Test; import com.google.refine.RefineTest; import com.google.refine.operations.OperationRegistry; -import com.google.refine.operations.row.RowRemovalOperation; import com.google.refine.util.ParsingUtilities; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/operations/row/RowReorderOperationTests.java b/main/tests/server/src/com/google/refine/operations/row/RowReorderOperationTests.java index 94a4c0cc2..3e6943a8d 100644 --- a/main/tests/server/src/com/google/refine/operations/row/RowReorderOperationTests.java +++ b/main/tests/server/src/com/google/refine/operations/row/RowReorderOperationTests.java @@ -41,7 +41,6 @@ import com.google.refine.model.AbstractOperation; import com.google.refine.model.Cell; import com.google.refine.model.Project; import com.google.refine.operations.OperationRegistry; -import com.google.refine.operations.row.RowReorderOperation; import com.google.refine.process.Process; import com.google.refine.sorting.SortingConfig; import com.google.refine.util.ParsingUtilities; diff --git a/main/tests/server/src/com/google/refine/operations/row/RowStarOperationTests.java b/main/tests/server/src/com/google/refine/operations/row/RowStarOperationTests.java index a3a321768..47a8999e6 100644 --- a/main/tests/server/src/com/google/refine/operations/row/RowStarOperationTests.java +++ b/main/tests/server/src/com/google/refine/operations/row/RowStarOperationTests.java @@ -31,7 +31,6 @@ import org.testng.annotations.Test; import com.google.refine.RefineTest; import com.google.refine.operations.OperationRegistry; -import com.google.refine.operations.row.RowStarOperation; import com.google.refine.util.ParsingUtilities; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/preference/PreferenceStoreTests.java b/main/tests/server/src/com/google/refine/preference/PreferenceStoreTests.java index 9eb25916f..03f41ec5a 100644 --- a/main/tests/server/src/com/google/refine/preference/PreferenceStoreTests.java +++ b/main/tests/server/src/com/google/refine/preference/PreferenceStoreTests.java @@ -35,7 +35,6 @@ import org.testng.annotations.Test; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; -import com.google.refine.preference.PreferenceStore; import com.google.refine.util.ParsingUtilities; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/preference/TopListTests.java b/main/tests/server/src/com/google/refine/preference/TopListTests.java index 05e8a11a5..ced3ba05c 100644 --- a/main/tests/server/src/com/google/refine/preference/TopListTests.java +++ b/main/tests/server/src/com/google/refine/preference/TopListTests.java @@ -33,8 +33,6 @@ import org.testng.annotations.Test; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; -import com.google.refine.preference.PreferenceValue; -import com.google.refine.preference.TopList; import com.google.refine.util.ParsingUtilities; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/process/LongRunningProcessTests.java b/main/tests/server/src/com/google/refine/process/LongRunningProcessTests.java index 2afc04c0b..ff8488715 100644 --- a/main/tests/server/src/com/google/refine/process/LongRunningProcessTests.java +++ b/main/tests/server/src/com/google/refine/process/LongRunningProcessTests.java @@ -28,7 +28,6 @@ package com.google.refine.process; import org.testng.annotations.Test; -import com.google.refine.process.LongRunningProcess; import com.google.refine.util.TestUtils; public class LongRunningProcessTests { diff --git a/main/tests/server/src/com/google/refine/process/ProcessManagerTests.java b/main/tests/server/src/com/google/refine/process/ProcessManagerTests.java index 4cdee4951..d07f6e981 100644 --- a/main/tests/server/src/com/google/refine/process/ProcessManagerTests.java +++ b/main/tests/server/src/com/google/refine/process/ProcessManagerTests.java @@ -29,8 +29,6 @@ package com.google.refine.process; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import com.google.refine.process.Process; -import com.google.refine.process.ProcessManager; import com.google.refine.util.ParsingUtilities; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/process/QuickHistoryEntryProcessTests.java b/main/tests/server/src/com/google/refine/process/QuickHistoryEntryProcessTests.java index d98ca21f2..91aa76a03 100644 --- a/main/tests/server/src/com/google/refine/process/QuickHistoryEntryProcessTests.java +++ b/main/tests/server/src/com/google/refine/process/QuickHistoryEntryProcessTests.java @@ -32,8 +32,6 @@ import org.testng.annotations.Test; import com.google.refine.history.HistoryEntry; import com.google.refine.model.Project; -import com.google.refine.process.Process; -import com.google.refine.process.QuickHistoryEntryProcess; import com.google.refine.util.TestUtils; public class QuickHistoryEntryProcessTests { diff --git a/main/tests/server/src/com/google/refine/sorting/BooleanCriterionTest.java b/main/tests/server/src/com/google/refine/sorting/BooleanCriterionTest.java index 81b06616c..e3ef3017a 100644 --- a/main/tests/server/src/com/google/refine/sorting/BooleanCriterionTest.java +++ b/main/tests/server/src/com/google/refine/sorting/BooleanCriterionTest.java @@ -30,7 +30,6 @@ import java.io.IOException; import org.testng.annotations.Test; -import com.google.refine.sorting.Criterion; import com.google.refine.util.ParsingUtilities; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/sorting/DateCriterionTest.java b/main/tests/server/src/com/google/refine/sorting/DateCriterionTest.java index af654e88b..4eef6c0b3 100644 --- a/main/tests/server/src/com/google/refine/sorting/DateCriterionTest.java +++ b/main/tests/server/src/com/google/refine/sorting/DateCriterionTest.java @@ -30,7 +30,6 @@ import java.io.IOException; import org.testng.annotations.Test; -import com.google.refine.sorting.Criterion; import com.google.refine.util.ParsingUtilities; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/sorting/NumberCriterionTest.java b/main/tests/server/src/com/google/refine/sorting/NumberCriterionTest.java index 0420ec11a..fdac23fc1 100644 --- a/main/tests/server/src/com/google/refine/sorting/NumberCriterionTest.java +++ b/main/tests/server/src/com/google/refine/sorting/NumberCriterionTest.java @@ -30,7 +30,6 @@ import java.io.IOException; import org.testng.annotations.Test; -import com.google.refine.sorting.Criterion; import com.google.refine.util.ParsingUtilities; import com.google.refine.util.TestUtils; diff --git a/main/tests/server/src/com/google/refine/sorting/SortingConfigTests.java b/main/tests/server/src/com/google/refine/sorting/SortingConfigTests.java index 9edc6fbb1..d5eb6c250 100644 --- a/main/tests/server/src/com/google/refine/sorting/SortingConfigTests.java +++ b/main/tests/server/src/com/google/refine/sorting/SortingConfigTests.java @@ -30,7 +30,6 @@ import java.io.IOException; import org.testng.annotations.Test; -import com.google.refine.sorting.SortingConfig; import com.google.refine.util.TestUtils; public class SortingConfigTests { diff --git a/main/tests/server/src/com/google/refine/util/PatternSyntaxExceptionParserTests.java b/main/tests/server/src/com/google/refine/util/PatternSyntaxExceptionParserTests.java index 39db09adf..ee409b772 100644 --- a/main/tests/server/src/com/google/refine/util/PatternSyntaxExceptionParserTests.java +++ b/main/tests/server/src/com/google/refine/util/PatternSyntaxExceptionParserTests.java @@ -42,7 +42,6 @@ import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import com.google.refine.RefineTest; -import com.google.refine.util.PatternSyntaxExceptionParser; public class PatternSyntaxExceptionParserTests extends RefineTest { From 441c069bc58612e7b8cf2359325c109fa4cb424d Mon Sep 17 00:00:00 2001 From: Tom Morris Date: Sat, 22 Aug 2020 18:57:05 -0400 Subject: [PATCH 4/5] Add some string function tests Including a test for Apache TEXT-149 behavior change https://github.com/apache/commons-text/pull/119 Add some more string function tests --- .../refine/expr/functions/ToStringTests.java | 10 ++-- .../expr/functions/strings/ChompTests.java | 16 +++++- .../expr/functions/strings/EndsWithTests.java | 12 ++++- .../expr/functions/strings/EscapeTests.java | 50 ++++++++++--------- .../expr/functions/strings/ReplaceTests.java | 21 +++++++- .../expr/functions/strings/SplitTests.java | 13 ++++- .../functions/strings/StartsWithTests.java | 12 ++++- .../functions/strings/ToLowercaseTests.java | 21 +++++++- .../expr/functions/strings/TrimTests.java | 3 -- .../expr/functions/strings/UnescapeTests.java | 11 ++-- 10 files changed, 129 insertions(+), 40 deletions(-) diff --git a/main/tests/server/src/com/google/refine/expr/functions/ToStringTests.java b/main/tests/server/src/com/google/refine/expr/functions/ToStringTests.java index 606180887..14eef7be0 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/ToStringTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/ToStringTests.java @@ -48,9 +48,9 @@ public class ToStringTests extends RefineTest { public void testToString() throws CalendarParserException { assertTrue(invoke("toString") instanceof EvalError); assertEquals(invoke("toString", (Object) null), ""); - assertEquals(invoke("toString", Long.valueOf(100)),"100"); - assertEquals(invoke("toString", Double.valueOf(100.0)),"100.0"); - assertEquals(invoke("toString", Double.valueOf(100.0),"%.0f"),"100"); + assertEquals(invoke("toString", Long.valueOf(100)), "100"); + assertEquals(invoke("toString", Double.valueOf(100.0)), "100.0"); + assertEquals(invoke("toString", Double.valueOf(100.0),"%.0f"), "100"); String inputDate = "2013-06-01"; assertEquals(invoke("toString", CalendarParser.parseAsOffsetDateTime(inputDate)), "2013-06-01T00:00:00Z"); @@ -61,8 +61,8 @@ public class ToStringTests extends RefineTest { String inputDateTime = "2013-06-01 13:12:11"; assertEquals(invoke("toString", CalendarParser.parseAsOffsetDateTime(inputDateTime)), "2013-06-01T13:12:11Z"); assertEquals(invoke("toString", CalendarParser.parseAsOffsetDateTime(inputDateTime), "yyyy-MM-dd"), "2013-06-01"); - assertEquals(invoke("toString", CalendarParser.parseAsOffsetDateTime(inputDateTime), "yyyy-MM-dd hh:mm:ss"),"2013-06-01 01:12:11"); - assertEquals(invoke("toString", CalendarParser.parseAsOffsetDateTime(inputDateTime), "yyyy-MM-dd HH:mm:ss"),"2013-06-01 13:12:11"); + assertEquals(invoke("toString", CalendarParser.parseAsOffsetDateTime(inputDateTime), "yyyy-MM-dd hh:mm:ss"), "2013-06-01 01:12:11"); + assertEquals(invoke("toString", CalendarParser.parseAsOffsetDateTime(inputDateTime), "yyyy-MM-dd HH:mm:ss"), "2013-06-01 13:12:11"); } } diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/ChompTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/ChompTests.java index 1c628ae54..0ea758b0c 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/ChompTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/ChompTests.java @@ -26,15 +26,29 @@ ******************************************************************************/ package com.google.refine.expr.functions.strings; +import static org.testng.Assert.assertEquals; + import org.testng.annotations.Test; +import com.google.refine.RefineTest; import com.google.refine.util.TestUtils; -public class ChompTests { +public class ChompTests extends RefineTest { @Test public void serializeChomp() { String json = "{\"description\":\"Removes separator from the end of str if it's there, otherwise leave it alone.\",\"params\":\"string str, string separator\",\"returns\":\"string\"}"; TestUtils.isSerializedTo(new Chomp(), json); } + + @Test + public void testChomp() { + // FIXME: These return null instead of an EvalError +// assertTrue(invoke("chomp") instanceof EvalError); +// assertTrue(invoke("chomp", "") instanceof EvalError); +// assertTrue(invoke("chomp", 1, 1) instanceof EvalError); + assertEquals(invoke("chomp", "test,", ","), "test"); + assertEquals(invoke("chomp", "test,", ":"), "test,"); + } + } diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/EndsWithTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/EndsWithTests.java index 9c59b6d56..9b462e9c9 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/EndsWithTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/EndsWithTests.java @@ -26,15 +26,25 @@ ******************************************************************************/ package com.google.refine.expr.functions.strings; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertTrue; + import org.testng.annotations.Test; +import com.google.refine.RefineTest; import com.google.refine.util.TestUtils; -public class EndsWithTests { +public class EndsWithTests extends RefineTest { @Test public void serializeEndsWith() { String json = "{\"description\":\"Returns whether s ends with sub\",\"params\":\"string s, string sub\",\"returns\":\"boolean\"}"; TestUtils.isSerializedTo(new EndsWith(), json); } + + @Test + public void testStartsWith() { + assertTrue((Boolean) invoke("endsWith", "testString", "ing")); + assertFalse((Boolean) invoke("startsWith", "testString", "banana")); + } } diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/EscapeTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/EscapeTests.java index c8a353dc3..fb329715d 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/EscapeTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/EscapeTests.java @@ -43,28 +43,32 @@ public class EscapeTests extends RefineTest { @Test public void testEscape() { - assertNull(invoke("escape")); - assertEquals(invoke("escape",null,"xml"),""); - assertEquals(invoke("escape", "mystring", "html"),"mystring"); - assertEquals(invoke("escape", "mystring", "xml"),"mystring"); - assertEquals(invoke("escape", "mystring", "csv"),"mystring"); - assertEquals(invoke("escape", "mystring", "url"),"mystring"); - assertEquals(invoke("escape", "mystring", "javascript"),"mystring"); - assertEquals(invoke("escape", 1, "html"),"1"); - assertEquals(invoke("escape", 1, "xml"),"1"); - assertEquals(invoke("escape", 1, "csv"),"1"); - assertEquals(invoke("escape", 1, "url"),"1"); - assertEquals(invoke("escape", 1, "javascript"),"1"); - assertEquals(invoke("escape", Long.parseLong("1"), "html"),"1"); - assertEquals(invoke("escape", Long.parseLong("1"), "xml"),"1"); - assertEquals(invoke("escape", Long.parseLong("1"), "csv"),"1"); - assertEquals(invoke("escape", Long.parseLong("1"), "url"),"1"); - assertEquals(invoke("escape", Long.parseLong("1"), "javascript"),"1"); - assertEquals(invoke("escape", Double.parseDouble("1.23"), "html"),"1.23"); - assertEquals(invoke("escape", Double.parseDouble("1.23"), "xml"),"1.23"); - assertEquals(invoke("escape", Double.parseDouble("1.23"), "csv"),"1.23"); - assertEquals(invoke("escape", Double.parseDouble("1.23"), "url"),"1.23"); - assertEquals(invoke("escape", Double.parseDouble("1.23"), "javascript"),"1.23"); - } + assertNull(invoke("escape")); + assertEquals(invoke("escape",null,"xml"), ""); + assertEquals(invoke("escape", "mystring", "html"), "mystring"); + assertEquals(invoke("escape", "mystring", "xml"), "mystring"); + assertEquals(invoke("escape", "mystring", "csv"), "mystring"); + assertEquals(invoke("escape", "mystring", "url"), "mystring"); + assertEquals(invoke("escape", "mystring", "javascript"), "mystring"); + assertEquals(invoke("escape", 1, "html") ,"1"); + assertEquals(invoke("escape", 1, "xml"), "1"); + assertEquals(invoke("escape", 1, "csv"), "1"); + assertEquals(invoke("escape", 1, "url"), "1"); + assertEquals(invoke("escape", 1, "javascript"), "1"); + assertEquals(invoke("escape", Long.parseLong("1"), "html"), "1"); + assertEquals(invoke("escape", Long.parseLong("1"), "xml"), "1"); + assertEquals(invoke("escape", Long.parseLong("1"), "csv"), "1"); + assertEquals(invoke("escape", Long.parseLong("1"), "url"), "1"); + assertEquals(invoke("escape", Long.parseLong("1"), "javascript"), "1"); + assertEquals(invoke("escape", Double.parseDouble("1.23"), "html"), "1.23"); + assertEquals(invoke("escape", Double.parseDouble("1.23"), "xml"), "1.23"); + assertEquals(invoke("escape", Double.parseDouble("1.23"), "csv"), "1.23"); + assertEquals(invoke("escape", Double.parseDouble("1.23"), "url"), "1.23"); + assertEquals(invoke("escape", Double.parseDouble("1.23"), "javascript"), "1.23"); + + assertEquals("\",\"", invoke("escape", ",", "csv")); // commas get quoted + assertEquals("\"\n\"", invoke("escape", "\n", "csv")); // newlines get quoted + assertEquals("\"\"\"\"", invoke("escape", "\"", "csv")); // quotes get doubled + } } diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/ReplaceTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/ReplaceTests.java index 09b4158bc..a834abe44 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/ReplaceTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/ReplaceTests.java @@ -26,15 +26,34 @@ ******************************************************************************/ package com.google.refine.expr.functions.strings; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; + import org.testng.annotations.Test; +import com.google.refine.RefineTest; +import com.google.refine.expr.EvalError; import com.google.refine.util.TestUtils; -public class ReplaceTests { +public class ReplaceTests extends RefineTest { @Test public void serializeReplace() { String json = "{\"description\":\"Returns the string obtained by replacing f with r in s\",\"params\":\"string s, string or regex f, string r\",\"returns\":\"string\"}"; TestUtils.isSerializedTo(new Replace(), json); } + + @Test + public void testReplace() { + assertTrue(invoke("replace") instanceof EvalError); + assertTrue(invoke("replace", "test") instanceof EvalError); + assertTrue(invoke("replace", "test", "test") instanceof EvalError); + assertTrue(invoke("replace", "test", "test", null) instanceof EvalError); + assertEquals(invoke("replace", "", "ripe", "green"), ""); + assertEquals(invoke("replace", "", "", ""), ""); + assertEquals(invoke("replace", "ripe banana", "ripe", "green"), "green banana"); + assertEquals(invoke("replace", "ripe banana", "ripe", ""), " banana"); + assertEquals(invoke("replace", "ripe banana", "wrong", "green"), "ripe banana"); + assertEquals(invoke("replace", "ripe ripe banana", "ripe", "green"), "green green banana"); + } } diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/SplitTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/SplitTests.java index a4ad884bb..1a6f76ddf 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/SplitTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/SplitTests.java @@ -26,15 +26,26 @@ ******************************************************************************/ package com.google.refine.expr.functions.strings; +import static org.testng.Assert.assertEquals; + import org.testng.annotations.Test; +import com.google.refine.RefineTest; import com.google.refine.util.TestUtils; -public class SplitTests { +public class SplitTests extends RefineTest { @Test public void serializeSplit() { String json = "{\"description\":\"Returns the array of strings obtained by splitting s with separator sep. If preserveAllTokens is true, then empty segments are preserved.\",\"params\":\"string s, string or regex sep, optional boolean preserveAllTokens\",\"returns\":\"array\"}"; TestUtils.isSerializedTo(new Split(), json); } + + @Test + public void testSplit() { + assertEquals(invoke("split", "a,,b,c,d", ","), new String[] {"a", "b", "c", "d"}); + assertEquals(invoke("split", "a,,b,c,d", ",", true), new String[] {"a", "", "b", "c", "d"}); + assertEquals(invoke("split", "", ","), new String[] {}); + assertEquals(invoke("split", ",,,", ","), new String[] {""}); // TODO: Should this return an empty array? + } } diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/StartsWithTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/StartsWithTests.java index 37a7335c5..1910e7560 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/StartsWithTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/StartsWithTests.java @@ -26,15 +26,25 @@ ******************************************************************************/ package com.google.refine.expr.functions.strings; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertTrue; + import org.testng.annotations.Test; +import com.google.refine.RefineTest; import com.google.refine.util.TestUtils; -public class StartsWithTests { +public class StartsWithTests extends RefineTest { @Test public void serializeStartsWith() { String json = "{\"description\":\"Returns whether s starts with sub\",\"params\":\"string s, string sub\",\"returns\":\"boolean\"}"; TestUtils.isSerializedTo(new StartsWith(), json); } + + @Test + public void testStartsWith() { + assertTrue((Boolean) invoke("startsWith", "testString", "test")); + assertFalse((Boolean) invoke("startsWith", "testString", "banana")); + } } diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/ToLowercaseTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/ToLowercaseTests.java index bb2594ce3..4f28306fe 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/ToLowercaseTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/ToLowercaseTests.java @@ -26,15 +26,34 @@ ******************************************************************************/ package com.google.refine.expr.functions.strings; +import org.testng.Assert; import org.testng.annotations.Test; +import com.google.refine.RefineTest; +import com.google.refine.expr.EvalError; import com.google.refine.util.TestUtils; -public class ToLowercaseTests { +public class ToLowercaseTests extends RefineTest { @Test public void serializeToLowercase() { String json = "{\"description\":\"Returns s converted to lowercase\",\"params\":\"string s\",\"returns\":\"string\"}"; TestUtils.isSerializedTo(new ToLowercase(), json); } + + @Test + public void testtoLowercaseInvalidParams() { + Assert.assertTrue(invoke("toLowercase") instanceof EvalError); + Assert.assertTrue(invoke("toLowercase", (Object[])null) instanceof EvalError); + Assert.assertTrue(invoke("toLowercase", "one", "two", "three") instanceof EvalError); + } + + @Test + public void testtoLowercase() { + Assert.assertEquals((String)(invoke("toLowercase", "One")), "one"); + Assert.assertEquals((String)(invoke("toLowercase", "Ône")), "ône"); + Assert.assertEquals((String)(invoke("toLowercase", "ONE")), "one"); + Assert.assertEquals((String)(invoke("toLowercase", 1)), "1"); + Assert.assertEquals((String)(invoke("toLowercase", true)), "true"); + } } diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/TrimTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/TrimTests.java index 41c7d45c8..0dd929ced 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/TrimTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/TrimTests.java @@ -26,8 +26,6 @@ ******************************************************************************/ package com.google.refine.expr.functions.strings; -import java.util.Properties; - import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.BeforeTest; @@ -40,7 +38,6 @@ import com.google.refine.util.TestUtils; public class TrimTests extends RefineTest { - static Properties bindings; private static String NBSP = "\u00A0"; private static String ENQUAD = "\u2000"; private static String EMQUAD = "\u2001"; diff --git a/main/tests/server/src/com/google/refine/expr/functions/strings/UnescapeTests.java b/main/tests/server/src/com/google/refine/expr/functions/strings/UnescapeTests.java index fb93c21e6..93e22cacc 100644 --- a/main/tests/server/src/com/google/refine/expr/functions/strings/UnescapeTests.java +++ b/main/tests/server/src/com/google/refine/expr/functions/strings/UnescapeTests.java @@ -26,7 +26,7 @@ ******************************************************************************/ package com.google.refine.expr.functions.strings; -import static org.testng.AssertJUnit.assertEquals; +import static org.testng.Assert.assertEquals; import org.testng.annotations.Test; @@ -42,8 +42,13 @@ public class UnescapeTests extends RefineTest { @Test public void testUnescape() { - assertEquals(invoke("unescape", "Ä", "html"),"Ä"); - assertEquals(invoke("unescape", "\\u00C4", "javascript"),"Ä"); + assertEquals(invoke("unescape", "Ä", "html"), "Ä"); + assertEquals(invoke("unescape", "\\u00C4", "javascript"), "Ä"); + + assertEquals(invoke("unescape", "\"Test\"", "csv"), "Test"); // Apache TEXT-149 https://github.com/apache/commons-text/pull/119 + assertEquals(invoke("unescape", "\"This \"\"is\"\" a test\"", "csv"), "This \"is\" a test"); + assertEquals(invoke("unescape", "\"\n\"", "csv"), "\n"); + assertEquals(invoke("unescape", "\"a, b\"", "csv"), "a, b"); } } From 95756bf11f07a164374b3c35c8c44c27b1d210ba Mon Sep 17 00:00:00 2001 From: Tom Morris Date: Sat, 22 Aug 2020 20:30:23 -0400 Subject: [PATCH 5/5] Replace deprecated constant --- main/src/com/google/refine/expr/functions/strings/Trim.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/src/com/google/refine/expr/functions/strings/Trim.java b/main/src/com/google/refine/expr/functions/strings/Trim.java index 6d75a74ca..89cf1ac08 100644 --- a/main/src/com/google/refine/expr/functions/strings/Trim.java +++ b/main/src/com/google/refine/expr/functions/strings/Trim.java @@ -46,7 +46,7 @@ public class Trim implements Function { if (args.length == 1) { Object s1 = args[0]; if (s1 != null && s1 instanceof String) { - return CharMatcher.WHITESPACE.trimFrom((String) s1); + return CharMatcher.whitespace().trimFrom((String) s1); } } return new EvalError("Invalid parameters");