Apache Lucene open-source search software
SOLR-6048 the assert was not really failing the test
Noble Paul51412938e5ad
diff --git a/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java b/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.javaindex 249a1afc0f3..6045731e95b 100644--- a/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java+++ b/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java@@ -26,7 +26,6 @@ import org.apache.lucene.search.similarities.DefaultSimilarity;import org.apache.lucene.util.TestUtil;import org.apache.solr.SolrTestCaseJ4;import org.apache.solr.common.SolrDocument;-import org.apache.solr.common.SolrDocumentList;import org.apache.solr.common.params.CommonParams;import org.apache.solr.common.SolrException;import org.apache.solr.common.SolrInputDocument;@@ -407,16 +406,16 @@ public class DocumentBuilderTest extends SolrTestCaseJ4 {SolrDocument doc2 = new SolrDocument();doc2.addField("foo", randomString);- assertTrue(assertSolrDocumentEquals(doc1, doc2));+ assertTrue(compareSolrDocument(doc1, doc2));doc1.addField("foo", "bar");- assertFalse(assertSolrDocumentEquals(doc1, doc2));+ assertFalse(compareSolrDocument(doc1, doc2));doc1 = new SolrDocument();doc1.addField("bar", randomString);- assertFalse(assertSolrDocumentEquals(doc1, doc2));+ assertFalse(compareSolrDocument(doc1, doc2));int randomInt = random().nextInt();doc1 = new SolrDocument();@@ -424,12 +423,12 @@ public class DocumentBuilderTest extends SolrTestCaseJ4 {doc2 = new SolrDocument();doc2.addField("foo", randomInt);- assertTrue(assertSolrDocumentEquals(doc1, doc2));+ assertTrue(compareSolrDocument(doc1, doc2));doc2 = new SolrDocument();doc2.addField("bar", randomInt);- assertFalse(assertSolrDocumentEquals(doc1, doc2));+ assertFalse(compareSolrDocument(doc1, doc2));}@@ -442,16 +441,16 @@ public class DocumentBuilderTest extends SolrTestCaseJ4 {SolrInputDocument doc2 = new SolrInputDocument();doc2.addField("foo", randomString);- assertTrue(assertSolrInputDocumentEquals(doc1, doc2));+ assertTrue(compareSolrInputDocument(doc1, doc2));doc1.setDocumentBoost(1.1f);- assertFalse(assertSolrInputDocumentEquals(doc1, doc2));+ assertFalse(compareSolrInputDocument(doc1, doc2));doc2.setDocumentBoost(1.1f);- assertTrue(assertSolrInputDocumentEquals(doc1, doc2));+ assertTrue(compareSolrInputDocument(doc1, doc2));doc2.setDocumentBoost(20f);- assertFalse(assertSolrInputDocumentEquals(doc1, doc2));+ assertFalse(compareSolrInputDocument(doc1, doc2));doc1 = new SolrInputDocument();@@ -463,15 +462,15 @@ public class DocumentBuilderTest extends SolrTestCaseJ4 {childDoc.addField("foo", "bar");doc1.addChildDocument(childDoc);- assertFalse(assertSolrInputDocumentEquals(doc1, doc2));+ assertFalse(compareSolrInputDocument(doc1, doc2));doc2.addChildDocument(childDoc);- assertTrue(assertSolrInputDocumentEquals(doc1, doc2));+ assertTrue(compareSolrInputDocument(doc1, doc2));SolrInputDocument childDoc1 = new SolrInputDocument();childDoc.addField(TestUtil.randomSimpleString(random()), TestUtil.randomSimpleString(random()));doc2.addChildDocument(childDoc1);- assertFalse(assertSolrInputDocumentEquals(doc1, doc2));+ assertFalse(compareSolrInputDocument(doc1, doc2));}diff --git a/solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.java b/solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.javaindex c1cb27998d0..96fbf047089 100644--- a/solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.java+++ b/solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.java@@ -32,7 +32,6 @@ import java.util.List;import java.util.Map;import org.apache.commons.io.IOUtils;-import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util.TestUtil;import org.apache.solr.SolrTestCaseJ4;import org.apache.solr.common.EnumFieldValue;@@ -183,13 +182,13 @@ public class TestJavaBinCodec extends SolrTestCaseJ4 {byte[] b2 = (byte[]) matchObj.get(i);assertTrue(Arrays.equals(b1, b2));} else if(unmarshaledObj.get(i) instanceof SolrDocument && matchObj.get(i) instanceof SolrDocument ) {- assertSolrDocumentEquals(unmarshaledObj.get(i), matchObj.get(i));+ assertTrue(compareSolrDocument(unmarshaledObj.get(i), matchObj.get(i)));} else if(unmarshaledObj.get(i) instanceof SolrDocumentList && matchObj.get(i) instanceof SolrDocumentList ) {- assertSolrDocumentEquals(unmarshaledObj.get(i), matchObj.get(i));+ assertTrue(compareSolrDocumentList(unmarshaledObj.get(i), matchObj.get(i)));} else if(unmarshaledObj.get(i) instanceof SolrInputDocument && matchObj.get(i) instanceof SolrInputDocument) {- assertSolrInputDocumentEquals(unmarshaledObj.get(i), matchObj.get(i));+ assertTrue(compareSolrInputDocument(unmarshaledObj.get(i), matchObj.get(i)));} else if(unmarshaledObj.get(i) instanceof SolrInputField && matchObj.get(i) instanceof SolrInputField) {- assertSolrInputFieldEquals(unmarshaledObj.get(i), matchObj.get(i));+ assertTrue(assertSolrInputFieldEquals(unmarshaledObj.get(i), matchObj.get(i)));} else {assertEquals(unmarshaledObj.get(i), matchObj.get(i));}@@ -213,7 +212,7 @@ public class TestJavaBinCodec extends SolrTestCaseJ4 {InputStream is = getClass().getResourceAsStream(SOLRJ_JAVABIN_BACKCOMPAT_BIN_CHILD_DOCS);SolrDocument sdoc = (SolrDocument) javabin.unmarshal(is);SolrDocument matchSolrDoc = generateSolrDocumentWithChildDocs();- assertTrue(assertSolrDocumentEquals(sdoc, matchSolrDoc));+ assertTrue(compareSolrDocument(sdoc, matchSolrDoc));} catch (IOException e) {throw e;}diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.javaindex ea1ea30be15..c0c0cb2f53c 100644--- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java+++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java@@ -1873,7 +1873,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {}}- public boolean assertSolrDocumentEquals(Object expected, Object actual) {+ public boolean compareSolrDocument(Object expected, Object actual) {if (!(expected instanceof SolrDocument) || !(actual instanceof SolrDocument)) {return false;@@ -1916,7 +1916,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {Iterator<SolrDocument> childDocsIter1 = solrDocument1.getChildDocuments().iterator();Iterator<SolrDocument> childDocsIter2 = solrDocument2.getChildDocuments().iterator();while(childDocsIter1.hasNext()) {- if(!assertSolrDocumentEquals(childDocsIter1.next(), childDocsIter2.next())) {+ if(!compareSolrDocument(childDocsIter1.next(), childDocsIter2.next())) {return false;}}@@ -1924,7 +1924,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {}}- public boolean assertSolrDocumentList(Object expected, Object actual) {+ public boolean compareSolrDocumentList(Object expected, Object actual) {if (!(expected instanceof SolrDocumentList) || !(actual instanceof SolrDocumentList)) {return false;}@@ -1941,14 +1941,14 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {return false;}for(int i=0; i<list1.getNumFound(); i++) {- if(!assertSolrDocumentEquals(list1.get(i), list2.get(i))) {+ if(!compareSolrDocument(list1.get(i), list2.get(i))) {return false;}}return true;}- public boolean assertSolrInputDocumentEquals(Object expected, Object actual) {+ public boolean compareSolrInputDocument(Object expected, Object actual) {if (!(expected instanceof SolrInputDocument) || !(actual instanceof SolrInputDocument)) {return false;@@ -1993,7 +1993,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {Iterator<SolrInputDocument> childDocsIter1 = sdoc1.getChildDocuments().iterator();Iterator<SolrInputDocument> childDocsIter2 = sdoc2.getChildDocuments().iterator();while(childDocsIter1.hasNext()) {- if(!assertSolrInputDocumentEquals(childDocsIter1.next(), childDocsIter2.next())) {+ if(!compareSolrInputDocument(childDocsIter1.next(), childDocsIter2.next())) {return false;}}