Remove uses of junit, closes #2133

This commit is contained in:
Antonin Delpeuch 2019-08-23 14:09:11 +01:00
parent 46acc21a43
commit 29f3cef3ec
36 changed files with 52 additions and 75 deletions

View File

@ -1,6 +1,6 @@
package org.openrefine.wikidata.commands;
import static org.junit.Assert.assertEquals;
import static org.testng.Assert.assertEquals;
import java.io.IOException;

View File

@ -23,7 +23,7 @@
******************************************************************************/
package org.openrefine.wikidata.commands;
import static org.junit.Assert.assertEquals;
import static org.testng.Assert.assertEquals;
import static org.mockito.Mockito.when;
import static org.openrefine.wikidata.testing.TestingData.jsonFromFile;

View File

@ -23,7 +23,7 @@
******************************************************************************/
package org.openrefine.wikidata.commands;
import static org.junit.Assert.assertTrue;
import static org.testng.Assert.assertTrue;
import static org.mockito.Mockito.when;
import static org.openrefine.wikidata.testing.TestingData.jsonFromFile;

View File

@ -23,7 +23,7 @@
******************************************************************************/
package org.openrefine.wikidata.commands;
import static org.junit.Assert.assertEquals;
import static org.testng.Assert.assertEquals;
import static org.mockito.Mockito.when;
import java.io.IOException;

View File

@ -23,7 +23,7 @@
******************************************************************************/
package org.openrefine.wikidata.editing;
import static org.junit.Assert.assertEquals;
import static org.testng.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

View File

@ -23,7 +23,7 @@
******************************************************************************/
package org.openrefine.wikidata.editing;
import static org.junit.Assert.assertEquals;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import java.util.Collections;

View File

@ -23,7 +23,7 @@
******************************************************************************/
package org.openrefine.wikidata.editing;
import static org.junit.Assert.assertEquals;
import static org.testng.Assert.assertEquals;
import org.openrefine.wikidata.testing.TestingData;
import org.openrefine.wikidata.updates.ItemUpdate;

View File

@ -23,7 +23,7 @@
******************************************************************************/
package org.openrefine.wikidata.exporters;
import static org.junit.Assert.assertEquals;
import static org.testng.Assert.assertEquals;
import java.math.BigDecimal;

View File

@ -23,7 +23,7 @@
******************************************************************************/
package org.openrefine.wikidata.exporters;
import static org.junit.Assert.assertEquals;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
import java.io.StringWriter;

View File

@ -23,7 +23,7 @@
******************************************************************************/
package org.openrefine.wikidata.operations;
import static org.junit.Assert.assertEquals;
import static org.testng.Assert.assertEquals;
import java.io.LineNumberReader;

View File

@ -23,8 +23,8 @@
******************************************************************************/
package org.openrefine.wikidata.operations;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;
import java.io.LineNumberReader;

View File

@ -23,7 +23,7 @@
******************************************************************************/
package org.openrefine.wikidata.qa;
import static org.junit.Assert.assertEquals;
import static org.testng.Assert.assertEquals;
import org.openrefine.wikidata.testing.JacksonSerializationTest;
import org.testng.annotations.BeforeMethod;

View File

@ -23,7 +23,7 @@
******************************************************************************/
package org.openrefine.wikidata.qa;
import static org.junit.Assert.assertEquals;
import static org.testng.Assert.assertEquals;
import org.openrefine.wikidata.testing.JacksonSerializationTest;
import org.testng.annotations.Test;

View File

@ -23,8 +23,8 @@
******************************************************************************/
package org.openrefine.wikidata.qa.scrutinizers;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import java.util.Arrays;
import java.util.Set;

View File

@ -23,8 +23,8 @@
******************************************************************************/
package org.openrefine.wikidata.schema;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

View File

@ -23,8 +23,8 @@
******************************************************************************/
package org.openrefine.wikidata.schema;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;
import org.openrefine.wikidata.testing.JacksonSerializationTest;
import org.testng.annotations.Test;

View File

@ -23,7 +23,7 @@
******************************************************************************/
package org.openrefine.wikidata.schema;
import static org.junit.Assert.assertEquals;
import static org.testng.Assert.assertEquals;
import java.text.ParseException;

View File

@ -23,7 +23,7 @@
******************************************************************************/
package org.openrefine.wikidata.schema;
import static org.junit.Assert.assertEquals;
import static org.testng.Assert.assertEquals;
import java.util.Collections;

View File

@ -23,7 +23,7 @@
******************************************************************************/
package org.openrefine.wikidata.schema;
import static org.junit.Assert.assertEquals;
import static org.testng.Assert.assertEquals;
import java.math.BigDecimal;

View File

@ -23,7 +23,7 @@
******************************************************************************/
package org.openrefine.wikidata.schema;
import static org.junit.Assert.assertEquals;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
import java.util.Arrays;

View File

@ -23,7 +23,7 @@
******************************************************************************/
package org.openrefine.wikidata.schema;
import static org.junit.Assert.assertEquals;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
import java.util.ArrayList;

View File

@ -23,10 +23,10 @@
******************************************************************************/
package org.openrefine.wikidata.schema.entityvalues;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotEquals;
import static org.testng.Assert.assertTrue;
import java.util.Collections;

View File

@ -23,7 +23,7 @@
******************************************************************************/
package org.openrefine.wikidata.testing;
import static org.junit.Assert.assertEquals;
import static org.testng.Assert.assertEquals;
import java.io.IOException;

View File

@ -23,10 +23,10 @@
******************************************************************************/
package org.openrefine.wikidata.updates;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotEquals;
import static org.testng.Assert.assertTrue;
import java.io.IOException;
import java.util.Arrays;

View File

@ -23,7 +23,7 @@
******************************************************************************/
package org.openrefine.wikidata.updates.scheduler;
import static org.junit.Assert.assertEquals;
import static org.testng.Assert.assertEquals;
import java.math.BigDecimal;
import java.util.Collections;

View File

@ -23,7 +23,7 @@
******************************************************************************/
package org.openrefine.wikidata.updates.scheduler;
import static org.junit.Assert.assertEquals;
import static org.testng.Assert.assertEquals;
import java.util.Arrays;
import java.util.List;

View File

@ -23,7 +23,7 @@
******************************************************************************/
package org.openrefine.wikidata.updates.scheduler;
import static org.junit.Assert.assertEquals;
import static org.testng.Assert.assertEquals;
import java.util.Arrays;
import java.util.Collections;

View File

@ -23,7 +23,7 @@
******************************************************************************/
package org.openrefine.wikidata.updates.scheduler;
import static org.junit.Assert.assertEquals;
import static org.testng.Assert.assertEquals;
import java.util.Arrays;
import java.util.List;

View File

@ -458,24 +458,6 @@
<version>2.23.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>1.7.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>1.7.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>

View File

@ -33,7 +33,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package com.google.refine.exporters.sql;
import static org.junit.Assert.assertNotEquals;
import static org.testng.Assert.assertNotEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

View File

@ -26,7 +26,7 @@
******************************************************************************/
package com.google.refine.expr.functions.strings;
import static org.junit.Assert.assertArrayEquals;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import java.util.Properties;
@ -36,7 +36,6 @@ import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import com.google.refine.expr.EvalError;
import com.google.refine.expr.functions.strings.SmartSplit;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
import com.google.refine.util.TestUtils;
@ -66,7 +65,7 @@ public class SmartSplitTests {
String testString = "teststring1,teststring2,teststring3,teststring4";
String[] expected = { "teststring1", "teststring2", "teststring3", "teststring4" };
String[] actual = (String[]) invoke("smartSplit", testString);
assertArrayEquals(expected, actual);
assertEquals(expected, actual);
}
@Test
@ -74,7 +73,7 @@ public class SmartSplitTests {
String testString = "teststring1 teststring2 teststring3 teststring4";
String[] expected = { "teststring1", "teststring2", "teststring3", "teststring4" };
String[] actual = (String[]) invoke("smartSplit", testString);
assertArrayEquals(expected, actual);
assertEquals(expected, actual);
}
@Test
@ -82,7 +81,7 @@ public class SmartSplitTests {
String testString = "teststring1#teststring2#teststring3#teststring4";
String[] expected = { "teststring1", "teststring2", "teststring3", "teststring4" };
String[] actual = (String[]) invoke("smartSplit", testString, '#');
assertArrayEquals(expected, actual);
assertEquals(expected, actual);
}
@Test
@ -90,7 +89,7 @@ public class SmartSplitTests {
String testString = "teststring1 teststring2 teststring3 teststring4";
String[] expected = { "teststring1", "teststring2", "teststring3", "teststring4" };
String[] actual = (String[]) invoke("smartSplit", testString, ' ');
assertArrayEquals(expected, actual);
assertEquals(expected, actual);
}
@Test
@ -98,7 +97,7 @@ public class SmartSplitTests {
String testString = "teststring1#@$teststring2#@$teststring3#@$teststring4";
String[] expected = { "teststring1", "teststring2", "teststring3", "teststring4" };
String[] actual = (String[]) invoke("smartSplit", testString, "#@$");
assertArrayEquals(expected, actual);
assertEquals(expected, actual);
}
/**

View File

@ -29,12 +29,10 @@ package com.google.refine.expr.util;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
import java.util.Arrays;
import org.testng.annotations.Test;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.refine.expr.util.JsonValueConverter;
import com.google.refine.util.ParsingUtilities;
public class JsonValueConverterTests {

View File

@ -30,7 +30,7 @@ import java.time.format.DateTimeFormatter;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import static org.junit.Assert.assertNull;
import static org.testng.Assert.assertNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

View File

@ -26,7 +26,7 @@
******************************************************************************/
package com.google.refine.model.changes;
import static org.junit.Assert.assertEquals;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
import java.io.InputStream;

View File

@ -26,8 +26,8 @@
******************************************************************************/
package com.google.refine.operations.recon;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;
import java.io.IOException;
import java.util.Collections;

View File

@ -26,8 +26,8 @@
******************************************************************************/
package com.google.refine.util;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
import java.io.File;
import java.io.IOException;
@ -35,7 +35,6 @@ import java.io.LineNumberReader;
import java.io.StringReader;
import java.io.StringWriter;
import com.fasterxml.jackson.core.JsonFactory.Feature;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
@ -46,7 +45,6 @@ import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.google.refine.util.ParsingUtilities;
public class TestUtils {
@ -86,7 +84,7 @@ public class TestUtils {
if (!jsonA.equals(jsonB)) {
jsonDiff(expected, actual);
}
assertEquals(jsonA, jsonB);
assertTrue(jsonA.equals(jsonB));
} catch(Exception e) {
fail("\""+expected+"\" and \""+actual+"\" are not equal as JSON strings.");
}