Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

junit.framework.Assert in junit.framework has been deprecated #335

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/test/java/com/lucidworks/spark/SolrSqlTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.lucidworks.spark;

import com.lucidworks.spark.util.EventsimUtil;
import junit.framework.Assert;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SQLContext;
Expand All @@ -12,6 +11,7 @@
import java.util.*;

import static com.lucidworks.spark.util.ConfigurationConstants.*;
import static org.junit.Assert.assertEquals;

public class SolrSqlTest extends RDDProcessorTestBase {

Expand Down Expand Up @@ -52,15 +52,15 @@ public void testSQLQueries() throws Exception {

String[] fieldNames = schema.fieldNames();
// list of fields that are indexed from {@code EventsimUtil#loadEventSimDataSet}
Assert.assertEquals(21, fieldNames.length); // 18 fields from the file + id + _root_ + artist_txt
assertEquals(21, fieldNames.length); // 18 fields from the file + id + _root_ + artist_txt
//assert fieldNames.length == 20;

Assert.assertEquals(schema.apply("ts").dataType().typeName(), DataTypes.TimestampType.typeName());
Assert.assertEquals(schema.apply("sessionId").dataType().typeName(), DataTypes.LongType.typeName());
Assert.assertEquals(schema.apply("length").dataType().typeName(), DataTypes.DoubleType.typeName());
Assert.assertEquals(schema.apply("song").dataType().typeName(), DataTypes.StringType.typeName());
assertEquals(schema.apply("ts").dataType().typeName(), DataTypes.TimestampType.typeName());
assertEquals(schema.apply("sessionId").dataType().typeName(), DataTypes.LongType.typeName());
assertEquals(schema.apply("length").dataType().typeName(), DataTypes.DoubleType.typeName());
assertEquals(schema.apply("song").dataType().typeName(), DataTypes.StringType.typeName());

Assert.assertEquals(21, ((Row)rows.get(0)).length());
assertEquals(21, ((Row)rows.get(0)).length());
}

// Filter using SQL syntax and escape field names
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

package com.lucidworks.spark.analysis;

import junit.framework.Assert;
import org.junit.Test;
import static org.junit.Assert.assertEquals;

import java.io.Reader;
import java.io.StringReader;
Expand Down Expand Up @@ -323,7 +323,7 @@ private static void assertExpectedTokens(LuceneTextAnalyzer analyzer, String in,

private static void assertExpectedTokens(LuceneTextAnalyzer analyzer, String field, String in, List<String> expected) {
List<String> output = analyzer.analyzeJava(field, in);
Assert.assertEquals(expected, output);
assertEquals(expected, output);
}

private static void assertExpectedTokens(LuceneTextAnalyzer analyzer, Reader reader, List<String> expected) {
Expand All @@ -332,7 +332,7 @@ private static void assertExpectedTokens(LuceneTextAnalyzer analyzer, Reader rea

private static void assertExpectedTokens(LuceneTextAnalyzer analyzer, String field, Reader reader, List<String> expected) {
List<String> output = analyzer.analyzeJava(field, reader);
Assert.assertEquals(expected, output);
assertEquals(expected, output);
}

private static void assertExpectedTokens(LuceneTextAnalyzer analyzer, List<String> in, List<String> expected) {
Expand All @@ -341,33 +341,33 @@ private static void assertExpectedTokens(LuceneTextAnalyzer analyzer, List<Strin

private static void assertExpectedTokens(LuceneTextAnalyzer analyzer, String field, List<String> in, List<String> expected) {
List<String> output = analyzer.analyzeMVJava(field, in);
Assert.assertEquals(expected, output);
assertEquals(expected, output);
}

private static void assertExpectedTokens
(LuceneTextAnalyzer analyzer, Map<String,String> fieldValues, Map<String,List<String>> expected) {
Map<String,List<String>> output = analyzer.analyzeJava(fieldValues);
Assert.assertEquals(expected, output);
assertEquals(expected, output);
}

private static void assertExpectedTokensMV // different name because type erasure
(LuceneTextAnalyzer analyzer, Map<String,List<String>> fieldValues, Map<String,List<String>> expected) {
Map<String,List<String>> output = analyzer.analyzeMVJava(fieldValues);
Assert.assertEquals(expected, output);
assertEquals(expected, output);
}

private static void assertExpectedJson
(LuceneTextAnalyzer analyzer, String field, String in, boolean stored, String expected) {
// TODO: compare parsed JSON rather than strings; direct string comparison is brittle, e.g. key ordering in JSON objects is not guaranteed
String output = analyzer.toPreAnalyzedJson(field, in, stored);
Assert.assertEquals(expected, output);
assertEquals(expected, output);
}

private static void assertExpectedJson
(LuceneTextAnalyzer analyzer, String field, Reader reader, boolean stored, String expected) {
// TODO: compare parsed JSON rather than strings; direct string comparison is brittle, e.g. key ordering in JSON objects is not guaranteed
String output = analyzer.toPreAnalyzedJson(field, reader, stored);
Assert.assertEquals(expected, output);
assertEquals(expected, output);
}

private String json(String singleQuoted) {
Expand Down