You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by no...@apache.org on 2019/02/28 23:14:29 UTC

[lucene-solr] branch branch_8x updated: SOLR-13282: JDBCStreamTest should use assertEquals(double, double, delta) instead of '==' to compare 2 double values

This is an automated email from the ASF dual-hosted git repository.

noble pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new 3fcf7fa  SOLR-13282: JDBCStreamTest should use assertEquals(double, double, delta) instead of '==' to compare 2 double values
3fcf7fa is described below

commit 3fcf7fa54ea06879456bcda19de43013a82e0321
Author: Noble Paul <no...@apache.org>
AuthorDate: Fri Mar 1 10:13:14 2019 +1100

    SOLR-13282: JDBCStreamTest should use assertEquals(double, double, delta) instead of '==' to compare 2 double values
---
 .../client/solrj/io/stream/JDBCStreamTest.java     | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/JDBCStreamTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/JDBCStreamTest.java
index 501c6dd..a44de5b 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/JDBCStreamTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/JDBCStreamTest.java
@@ -28,6 +28,7 @@ import java.util.List;
 import java.util.Locale;
 
 import org.apache.lucene.util.LuceneTestCase;
+import org.apache.solr.SolrTestCaseJ4.SuppressPointFields;
 import org.apache.solr.client.solrj.io.SolrClientCache;
 import org.apache.solr.client.solrj.io.Tuple;
 import org.apache.solr.client.solrj.io.comp.ComparatorOrder;
@@ -41,7 +42,6 @@ import org.apache.solr.client.solrj.request.CollectionAdminRequest;
 import org.apache.solr.client.solrj.request.UpdateRequest;
 import org.apache.solr.cloud.AbstractDistribZkTestBase;
 import org.apache.solr.cloud.SolrCloudTestCase;
-import org.apache.solr.SolrTestCaseJ4.SuppressPointFields;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
@@ -551,17 +551,17 @@ public class JDBCStreamTest extends SolrCloudTestCase {
 
       Tuple tuple = tuples.get(0);
       assertEquals("Netherlands", tuple.getString("country"));
-      assertTrue(4.3D == tuple.getDouble("max(rating)"));
-      assertTrue(2.2D == tuple.getDouble("min(rating)"));
-      assertTrue(3.6D == tuple.getDouble("avg(rating)"));
-      assertTrue(6D == tuple.getDouble("count(*)"));
+      assertEquals(4.3D , tuple.getDouble("max(rating)") , 0.0001);
+      assertEquals(2.2D , tuple.getDouble("min(rating)"), 0.0001);
+      assertEquals(3.6D, tuple.getDouble("avg(rating)"), 0.0001);
+      assertEquals(6D , tuple.getDouble("count(*)"), 0.0001);
 
       tuple = tuples.get(1);
       assertEquals("United States", tuple.getString("country"));
-      assertTrue(5D == tuple.getDouble("max(rating)"));
-      assertTrue(3D == tuple.getDouble("min(rating)"));
-      assertTrue(3.95D == tuple.getDouble("avg(rating)"));
-      assertTrue(4D == tuple.getDouble("count(*)"));
+      assertEquals(5D , tuple.getDouble("max(rating)"), 0.0001);
+      assertEquals(3D , tuple.getDouble("min(rating)"), 0.0001);
+      assertEquals(3.95D , tuple.getDouble("avg(rating)"),0.0001);
+      assertEquals(4D , tuple.getDouble("count(*)"), 0.0001);
     } finally {
       solrClientCache.close();
     }
@@ -609,9 +609,7 @@ public class JDBCStreamTest extends SolrCloudTestCase {
     for(double val : values) {
       Tuple t = tuples.get(i);
       double tip = (double)t.get(fieldName);
-      if(tip != val) {
-        throw new Exception("Found value:"+tip+" expecting:"+val);
-      }
+      assertEquals("Found value:"+tip+" expecting:"+val, val, tip, 0.00001);
       ++i;
     }
     return true;