Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

Use LogWatcher instead of ErrorLogMuter for RankFieldTest

Houston Putmand88ba42e2a03
diff --git a/solr/core/src/test/org/apache/solr/schema/RankFieldTest.java b/solr/core/src/test/org/apache/solr/schema/RankFieldTest.java
index cb354f1e398..3a4f1e48b5e 100644
--- a/solr/core/src/test/org/apache/solr/schema/RankFieldTest.java
+++ b/solr/core/src/test/org/apache/solr/schema/RankFieldTest.java
@@ -23,7 +23,7 @@ import org.apache.lucene.index.LeafReader;
import org.apache.lucene.util.BytesRef;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.common.params.ModifiableSolrParams;
-import org.apache.solr.util.ErrorLogMuter;
+import org.apache.solr.util.LogListener;
import org.apache.solr.util.TestHarness;
import org.junit.BeforeClass;
import org.junit.Ignore;
@@ -59,29 +59,32 @@ public class RankFieldTest extends SolrTestCaseJ4 {
}
public void testBadFormat() {
- try (ErrorLogMuter errors = ErrorLogMuter.substring("Expecting float")) {
+ try (LogListener errors = LogListener.error().substring("Expecting float")) {
assertFailedU(adoc("id", "1", RANK_1, "foo"));
assertFailedU(adoc("id", "1", RANK_1, "1.2.3"));
assertEquals(2, errors.getCount());
+ errors.clearQueue();
}
- try (ErrorLogMuter errors = ErrorLogMuter.substring("must be finite")) {
+ try (LogListener errors = LogListener.error().substring("must be finite")) {
assertFailedU(adoc("id", "1", RANK_1, Float.toString(Float.POSITIVE_INFINITY)));
assertFailedU(adoc("id", "1", RANK_1, Float.toString(Float.NEGATIVE_INFINITY)));
assertFailedU(adoc("id", "1", RANK_1, Float.toString(Float.NaN)));
assertEquals(3, errors.getCount());
+ errors.clearQueue();
}
- try (ErrorLogMuter errors = ErrorLogMuter.substring("must be a positive")) {
+ try (LogListener errors = LogListener.error().substring("must be a positive")) {
assertFailedU(adoc("id", "1", RANK_1, Float.toString(-0.0f)));
assertFailedU(adoc("id", "1", RANK_1, Float.toString(-1f)));
assertFailedU(adoc("id", "1", RANK_1, Float.toString(0.0f)));
assertEquals(3, errors.getCount());
+ errors.clearQueue();
}
}