You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2022/10/18 20:43:19 UTC

[GitHub] [solr] mkhludnev commented on a diff in pull request #953: SOLR-16311: Simplify assert statement

mkhludnev commented on code in PR #953:
URL: https://github.com/apache/solr/pull/953#discussion_r998298633


##########
solr/core/src/test/org/apache/solr/core/BlobRepositoryMockingTest.java:
##########
@@ -44,7 +39,7 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-public class BlobRepositoryMockingTest {
+public class BlobRepositoryMockingTest extends SolrTestCaseJ4 {

Review Comment:
   Whu, so? it seems doubtful. I'd rather avoid this change



##########
solr/core/src/test/org/apache/solr/core/backup/BackupFilePathsTest.java:
##########
@@ -16,16 +16,13 @@
  */
 package org.apache.solr.core.backup;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
 import java.util.List;
 import java.util.Optional;
+import org.apache.solr.SolrTestCase;
 import org.junit.Test;
 
 /** Unit tests for {@link BackupFilePaths} */
-public class BackupFilePathsTest {
+public class BackupFilePathsTest extends SolrTestCase {

Review Comment:
   Still not getting why



##########
solr/core/src/test/org/apache/solr/handler/TestSampleDocumentsLoader.java:
##########
@@ -40,7 +35,7 @@
 import org.junit.Before;
 import org.junit.Test;
 
-public class TestSampleDocumentsLoader {
+public class TestSampleDocumentsLoader extends SolrTestCase {

Review Comment:
   disagree



##########
solr/core/src/test/org/apache/solr/handler/ReplicationTestHelper.java:
##########
@@ -111,7 +108,7 @@ public static void assertVersions(SolrClient client1, SolrClient client2) throws
     Long maxVersionClient2 = getVersion(client2);
 
     if (maxVersionClient1 > 0 && maxVersionClient2 > 0) {
-      assertEquals(maxVersionClient1, maxVersionClient2);
+      SolrTestCaseJ4.assertEquals(maxVersionClient1, maxVersionClient2);

Review Comment:
   Why not JUnit's one?



##########
solr/core/src/test/org/apache/solr/handler/V2ClusterAPIMappingTest.java:
##########
@@ -48,7 +47,7 @@
 import org.mockito.ArgumentCaptor;
 
 /** Unit tests for the v2 to v1 API mappings found in {@link ClusterAPI} */
-public class V2ClusterAPIMappingTest {
+public class V2ClusterAPIMappingTest extends SolrTestCaseJ4 {

Review Comment:
   again, why?



##########
solr/core/src/test/org/apache/solr/handler/V2UpdateAPIMappingTest.java:
##########
@@ -39,7 +38,7 @@
 import org.junit.Test;
 
 /** Unit tests for the v2 to v1 mapping logic in {@link UpdateAPI} */
-public class V2UpdateAPIMappingTest {
+public class V2UpdateAPIMappingTest extends SolrTestCaseJ4 {

Review Comment:
   🥱



##########
solr/core/src/test/org/apache/solr/handler/admin/api/V2NodeAPIMappingTest.java:
##########
@@ -55,7 +53,7 @@
 import org.mockito.ArgumentCaptor;
 
 /** Unit tests for the v2 to v1 mapping for /node/ APIs. */
-public class V2NodeAPIMappingTest {
+public class V2NodeAPIMappingTest extends SolrTestCaseJ4 {

Review Comment:
   why?



##########
solr/core/src/test/org/apache/solr/parser/SolrQueryParserBaseTest.java:
##########
@@ -26,19 +24,17 @@
 import java.util.List;
 import org.apache.lucene.queryparser.charstream.CharStream;
 import org.apache.lucene.search.Query;
+import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.schema.IndexSchema;
 import org.apache.solr.search.QParser;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.Mockito;
 
-@RunWith(MockitoJUnitRunner.class)
-public class SolrQueryParserBaseTest {
+public class SolrQueryParserBaseTest extends SolrTestCaseJ4 {

Review Comment:
   Disagree with ancestor. 
   Why not @Mock, it seemed fine?



##########
solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java:
##########
@@ -640,7 +640,7 @@ public void testThresholdTokenFrequency() throws Exception {
     values = rsp.getValues();
     spellCheck = (NamedList<?>) values.get("spellcheck");
     suggestions = (NamedList<?>) spellCheck.get("suggestions");
-    assertTrue(suggestions.get("suggestion") == null);
-    assertTrue((Boolean) spellCheck.get("correctlySpelled") == false);
+    assertNull(suggestions.get("suggestion"));
+    assertFalse((boolean) (Boolean) spellCheck.get("correctlySpelled"));

Review Comment:
   (two) (casts)



##########
solr/core/src/test/org/apache/solr/update/SoftAutoCommitTest.java:
##########
@@ -637,6 +636,6 @@ public void clear() {
   }
 
   public void assertSaneOffers() {
-    assertEquals("Failure of MockEventListener" + fail.toString(), 0, fail.length());
+    SolrTestCaseJ4.assertEquals("Failure of MockEventListener" + fail.toString(), 0, fail.length());

Review Comment:
   Why classname is added?



##########
solr/core/src/test/org/apache/solr/util/hll/NumberUtilTest.java:
##########
@@ -70,65 +68,62 @@ public class NumberUtilTest {
   @Test
   public void testLog2() {
     final double log2Result = NumberUtil.log2(2d);
-    assertTrue(log2Result == 1);
+    assertEquals(1, log2Result, 0.0);

Review Comment:
   if it's a  double it might require epsilon. But I might miss a zero point



##########
solr/core/src/test/org/apache/solr/util/SolrCliUptimeTest.java:
##########
@@ -16,11 +16,10 @@
  */
 package org.apache.solr.util;
 
-import static org.junit.Assert.assertEquals;
-
+import org.apache.solr.SolrTestCase;
 import org.junit.Test;
 
-public class SolrCliUptimeTest {
+public class SolrCliUptimeTest extends SolrTestCase {

Review Comment:
   Why?



##########
solr/core/src/test/org/apache/solr/handler/TestSampleDocumentsLoader.java:
##########
@@ -63,7 +58,7 @@ public void testJson() throws Exception {
   @Test
   public void testCsv() throws Exception {
     ModifiableSolrParams params = new ModifiableSolrParams();
-    params.set(CSV_MULTI_VALUE_DELIM_PARAM, "\\|");
+    params.set(DefaultSampleDocumentsLoader.CSV_MULTI_VALUE_DELIM_PARAM, "\\|");

Review Comment:
   I'm not sure if it gets better



##########
solr/modules/sql/src/test/org/apache/solr/handler/sql/TestSQLHandler.java:
##########
@@ -1915,17 +1914,17 @@ public void testTimeSeriesGrouping() throws Exception {
 
     List<Tuple> tuples = getTuples(sParams, baseUrl);
 
-    assert (tuples.size() == 2);
+    assertEquals(2, tuples.size());
 
     Tuple tuple;
 
     tuple = tuples.get(0);
-    assert (tuple.getLong("year_i") == 2015);
-    assert (tuple.getDouble("EXPR$1") == 66); // sum(item_i)
+    assertEquals(2015, (long) tuple.getLong("year_i"));
+    assertEquals(66, tuple.getDouble("EXPR$1"), 0.0); // sum(item_i)
 
     tuple = tuples.get(1);
-    assert (tuple.getLong("year_i") == 2014);
-    assert (tuple.getDouble("EXPR$1") == 7); // sum(item_i)
+    assertEquals(2014, (long) tuple.getLong("year_i"));

Review Comment:
   can it be 2014L with no cast (long)?



##########
solr/modules/ltr/src/test/org/apache/solr/ltr/norm/TestMinMaxNormalizer.java:
##########
@@ -16,17 +16,14 @@
  */
 package org.apache.solr.ltr.norm;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
 import java.nio.file.Paths;
 import java.util.HashMap;
 import java.util.Map;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.core.SolrResourceLoader;
 import org.junit.Test;
 
-public class TestMinMaxNormalizer {
+public class TestMinMaxNormalizer extends SolrTestCaseJ4 {

Review Comment:
   disagree



##########
solr/modules/langid/src/test/org/apache/solr/update/processor/SolrInputDocumentReaderTest.java:
##########
@@ -16,21 +16,19 @@
  */
 package org.apache.solr.update.processor;
 
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
 import java.util.Arrays;
+import org.apache.solr.SolrTestCase;
 import org.apache.solr.common.SolrInputDocument;
 import org.junit.Before;
 import org.junit.Test;
 
-public class SolrInputDocumentReaderTest {
+public class SolrInputDocumentReaderTest extends SolrTestCase {

Review Comment:
   Why?



##########
solr/core/src/test/org/apache/solr/handler/ReplicationTestHelper.java:
##########
@@ -202,15 +199,16 @@ public static NamedList<Object> getDetails(SolrClient s) throws Exception {
     @SuppressWarnings("unchecked")
     NamedList<Object> details = (NamedList<Object>) res.get("details");
 
-    assertNotNull("null details", details);
+    SolrTestCaseJ4.assertNotNull("null details", details);
 
     return details;
   }
 
   public static void assertReplicationResponseSucceeded(NamedList<?> response) {
-    assertNotNull("null response from server", response);
-    assertNotNull("Expected replication response to have 'status' field", response.get("status"));
-    assertEquals("OK", response.get("status"));
+    SolrTestCaseJ4.assertNotNull("null response from server", response);

Review Comment:
   it's getting worse imho



##########
solr/core/src/test/org/apache/solr/handler/admin/SolrEnvironmentTest.java:
##########
@@ -17,13 +17,11 @@
 
 package org.apache.solr.handler.admin;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
+import org.apache.solr.SolrTestCase;
 import org.apache.solr.common.SolrException;
 import org.junit.Test;
 
-public class SolrEnvironmentTest {
+public class SolrEnvironmentTest extends SolrTestCase {

Review Comment:
   please explain



##########
solr/modules/sql/src/test/org/apache/solr/handler/sql/TestSQLHandler.java:
##########
@@ -425,22 +424,22 @@ public void testBasicSelect() throws Exception {
 
     tuples = getTuples(sParams, baseUrl);
 
-    assert (tuples.size() == 3);
+    assertEquals(3, tuples.size());
 
     tuple = tuples.get(0);
-    assert (tuple.getLong("myId") == 3);
-    assert (tuple.getLong("myInt") == 20);
-    assert (tuple.get("myString").equals("a"));
+    assertEquals(3, (long) tuple.getLong("myId"));

Review Comment:
   Can we avoid (long) cast with `3L` ?



##########
solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java:
##########
@@ -627,8 +627,8 @@ public void testThresholdTokenFrequency() throws Exception {
     NamedList<?> values = rsp.getValues();
     NamedList<?> spellCheck = (NamedList<?>) values.get("spellcheck");
     NamedList<?> suggestions = (NamedList<?>) spellCheck.get("suggestions");
-    assertTrue(suggestions.get("suggestion") == null);
-    assertTrue((Boolean) spellCheck.get("correctlySpelled") == false);
+    assertNull(suggestions.get("suggestion"));
+    assertFalse((boolean) (Boolean) spellCheck.get("correctlySpelled"));

Review Comment:
   these (two) (casts) seem weird



##########
solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBSolrClientTest.java:
##########
@@ -17,22 +17,19 @@
 
 package org.apache.solr.client.solrj.impl;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import org.apache.lucene.tests.util.LuceneTestCase;
+import org.apache.solr.SolrTestCase;
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.request.QueryRequest;
 import org.apache.solr.common.params.CommonParams;
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.junit.Test;
 
-public class LBSolrClientTest {
+public class LBSolrClientTest extends SolrTestCase {

Review Comment:
   Why?



##########
solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttpSolrClientTest.java:
##########
@@ -16,17 +16,15 @@
  */
 package org.apache.solr.client.solrj.impl;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
 import java.io.IOException;
 import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.solr.SolrTestCase;
 import org.apache.solr.client.solrj.ResponseParser;
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.junit.Test;
 
 /** Test the LBHttpSolrClient. */
-public class LBHttpSolrClientTest {
+public class LBHttpSolrClientTest extends SolrTestCase {

Review Comment:
   Why?



##########
solr/solrj/src/test/org/apache/solr/client/solrj/impl/SolrPortAwareCookieSpecTest.java:
##########
@@ -21,11 +21,10 @@
 import org.apache.http.cookie.MalformedCookieException;
 import org.apache.http.impl.cookie.BasicClientCookie;
 import org.apache.solr.SolrTestCaseJ4;
-import org.junit.Assert;
 import org.junit.Test;
 
 // Test cases imported from TestNetscapeCookieAttribHandlers of HttpClient project
-public class SolrPortAwareCookieSpecTest {
+public class SolrPortAwareCookieSpecTest extends SolrTestCaseJ4 {

Review Comment:
   Why not Assert?



##########
solr/core/src/test/org/apache/solr/metrics/DelegateRegistryTimerTest.java:
##########
@@ -17,18 +17,16 @@
 
 package org.apache.solr.metrics;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
 import com.codahale.metrics.Clock;
 import com.codahale.metrics.MetricRegistry;
 import com.codahale.metrics.Timer;
 import java.time.Duration;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicLong;
+import org.apache.solr.SolrTestCase;
 import org.junit.Test;
 
-public class DelegateRegistryTimerTest {
+public class DelegateRegistryTimerTest extends SolrTestCase {

Review Comment:
   Doubt



##########
solr/core/src/test/org/apache/solr/response/TestRetrieveFieldsOptimizer.java:
##########
@@ -616,7 +615,7 @@ List<String> getValsForField() {
         break;
 
       default:
-        fail("Found no case for field " + name + " type " + type);
+        SolrTestCaseJ4.fail("Found no case for field " + name + " type " + type);

Review Comment:
   Why to add class name?



##########
solr/prometheus-exporter/src/test/org/apache/solr/prometheus/exporter/MetricsQueryTemplateTest.java:
##########
@@ -36,7 +33,7 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.NodeList;
 
-public class MetricsQueryTemplateTest {
+public class MetricsQueryTemplateTest extends SolrTestCaseJ4 {

Review Comment:
   disagree



##########
solr/core/src/test/org/apache/solr/util/hll/NumberUtilTest.java:
##########
@@ -16,13 +16,11 @@
  */
 package org.apache.solr.util.hll;
 
-import static org.junit.Assert.assertTrue;
-
-import java.util.Arrays;
+import org.apache.solr.SolrTestCase;
 import org.junit.Test;
 
 /** Tests {@link NumberUtil} */
-public class NumberUtilTest {
+public class NumberUtilTest extends SolrTestCase {

Review Comment:
   Disagree



##########
solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java:
##########
@@ -869,7 +869,7 @@ public void testCopyFieldWithMaxCharsAccuracy() throws Exception {
         int currentMaxChars = (Integer) currentCopyField.get("maxChars");
         MatcherAssert.assertThat(
             currentDestFieldName, anyOf(is(equalTo(destFieldName1)), is(equalTo(destFieldName2))));
-        assertTrue(maxChars == currentMaxChars);
+        assertEquals((int) maxChars, currentMaxChars);

Review Comment:
   why (cast)?



##########
solr/solrj/src/test/org/apache/solr/common/util/URLUtilTest.java:
##########
@@ -16,13 +16,10 @@
  */
 package org.apache.solr.common.util;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
+import org.apache.solr.SolrTestCase;
 import org.junit.Test;
 
-public class URLUtilTest {
+public class URLUtilTest extends SolrTestCase {

Review Comment:
   Why?



##########
solr/solrj/src/test/org/apache/solr/client/solrj/io/graph/GraphExpressionTest.java:
##########
@@ -1075,15 +1075,15 @@ public void testGatherNodesFriendsStream() throws Exception {
     tuples = getTuples(stream);
 
     tuples.sort(new FieldComparator("node", ComparatorOrder.ASCENDING));
-    assertTrue(tuples.size() == 4);
-    assertTrue(tuples.get(0).getString("node").equals("bill"));
-    assertTrue(tuples.get(0).getLong("level").equals(0L));
-    assertTrue(tuples.get(1).getString("node").equals("jim"));
-    assertTrue(tuples.get(1).getLong("level").equals(1L));
-    assertTrue(tuples.get(2).getString("node").equals("max"));
-    assertTrue(tuples.get(2).getLong("level").equals(1L));
-    assertTrue(tuples.get(3).getString("node").equals("sam"));
-    assertTrue(tuples.get(3).getLong("level").equals(1L));
+    assertEquals(4, tuples.size());
+    assertEquals("bill", tuples.get(0).getString("node"));
+    assertEquals(0L, (long) tuples.get(0).getLong("level"));

Review Comment:
   How to avoid cast?



##########
solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttp2SolrClientTest.java:
##########
@@ -16,19 +16,16 @@
  */
 package org.apache.solr.client.solrj.impl;
 
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
 import java.io.IOException;
 import java.util.HashSet;
 import java.util.Set;
+import org.apache.solr.SolrTestCase;
 import org.apache.solr.client.solrj.ResponseParser;
 import org.apache.solr.client.solrj.request.RequestWriter;
 import org.junit.Test;
 
 /** Test the LBHttp2SolrClient. */
-public class LBHttp2SolrClientTest {
+public class LBHttp2SolrClientTest extends SolrTestCase {

Review Comment:
   Why?



##########
solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ConversionEvaluatorsTest.java:
##########
@@ -32,7 +30,7 @@
 import org.junit.Test;
 
 /** Test ConversionEvaluators */
-public class ConversionEvaluatorsTest {
+public class ConversionEvaluatorsTest extends SolrTestCase {

Review Comment:
   disagree



##########
solr/solrj/src/test/org/apache/solr/client/solrj/request/TestUpdateRequest.java:
##########
@@ -17,56 +17,55 @@
 package org.apache.solr.client.solrj.request;
 
 import java.util.Arrays;
+import org.apache.solr.SolrTestCase;
 import org.apache.solr.common.SolrInputDocument;
-import org.junit.Assert;
 import org.junit.Test;
 
-public class TestUpdateRequest {
+public class TestUpdateRequest extends SolrTestCase {

Review Comment:
   Can't it be just TestCase or Assert?



##########
solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/TemporalEvaluatorsTest.java:
##########
@@ -54,7 +52,7 @@
 import org.junit.Test;
 
 /** Tests numeric Date/Time stream evaluators */
-public class TemporalEvaluatorsTest {
+public class TemporalEvaluatorsTest extends SolrTestCase {

Review Comment:
   Changes below proves that adding ancestor is redundant 



##########
solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ArrayEvaluatorTest.java:
##########
@@ -54,12 +53,12 @@ public void arrayLongSortAscTest() throws IOException {
 
     result = evaluator.evaluate(new Tuple(values));
 
-    Assert.assertTrue(result instanceof List<?>);
+    assertTrue(result instanceof List<?>);
 
-    Assert.assertEquals(3, ((List<?>) result).size());

Review Comment:
   can't it be casted once ?



##########
solr/modules/analytics/src/test/org/apache/solr/analytics/legacy/facet/LegacyFieldFacetCloudTest.java:
##########
@@ -442,48 +440,48 @@ public void sumTest() throws Exception {
     String responseStr = response.toString();
 
     // Int Date
-    Collection<Double> intDate =
+    ArrayList<Double> intDate =

Review Comment:
   can't it be `List<Double>` ?



##########
solr/core/src/test/org/apache/solr/update/processor/SkipExistingDocumentsProcessorFactoryTest.java:
##########
@@ -38,7 +36,7 @@
 import org.junit.Test;
 import org.mockito.Mockito;
 
-public class SkipExistingDocumentsProcessorFactoryTest {
+public class SkipExistingDocumentsProcessorFactoryTest extends SolrTestCaseJ4 {

Review Comment:
   Disagree with just adding ancestor class. 



##########
solr/modules/ltr/src/test/org/apache/solr/ltr/norm/TestStandardNormalizer.java:
##########
@@ -16,17 +16,14 @@
  */
 package org.apache.solr.ltr.norm;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
 import java.nio.file.Paths;
 import java.util.HashMap;
 import java.util.Map;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.core.SolrResourceLoader;
 import org.junit.Test;
 
-public class TestStandardNormalizer {
+public class TestStandardNormalizer extends SolrTestCaseJ4 {

Review Comment:
   disagree



##########
solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/expr/InjectionDefenseTest.java:
##########
@@ -17,12 +17,10 @@
 
 package org.apache.solr.client.solrj.io.stream.expr;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
+import org.apache.solr.SolrTestCase;
 import org.junit.Test;
 
-public class InjectionDefenseTest {
+public class InjectionDefenseTest extends SolrTestCase {

Review Comment:
   Why? 



##########
solr/prometheus-exporter/src/test/org/apache/solr/prometheus/collector/MetricSamplesTest.java:
##########
@@ -27,9 +25,10 @@
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
+import org.apache.solr.SolrTestCase;
 import org.junit.Test;
 
-public class MetricSamplesTest {
+public class MetricSamplesTest extends SolrTestCase {

Review Comment:
   Why?



##########
solr/modules/sql/src/test/org/apache/solr/handler/sql/TestSQLHandler.java:
##########
@@ -2177,43 +2176,43 @@ public void testTimeSeriesGroupingFacet() throws Exception {
 
     tuples = getTuples(sParams, baseUrl);
 
-    assert (tuples.size() == 6);
+    assertEquals(6, tuples.size());
 
     tuple = tuples.get(0);
-    assert (tuple.getLong("year_i") == 2015);
-    assert (tuple.getLong("month_i") == 11);
-    assert (tuple.getLong("day_i") == 8);
-    assert (tuple.getDouble("EXPR$3") == 42); // sum(item_i)
+    assertEquals(2015, (long) tuple.getLong("year_i"));

Review Comment:
   How to avoid (long) cast?



##########
solr/modules/sql/src/test/org/apache/solr/handler/sql/TestSQLHandler.java:
##########
@@ -2308,43 +2308,43 @@ public void testParallelTimeSeriesGrouping() throws Exception {
 
     tuples = getTuples(sParams, baseUrl);
 
-    assert (tuples.size() == 6);
+    assertEquals(6, tuples.size());
 
     tuple = tuples.get(0);
-    assert (tuple.getLong("year_i") == 2015);
-    assert (tuple.getLong("month_i") == 11);
-    assert (tuple.getLong("day_i") == 8);
-    assert (tuple.getDouble("EXPR$3") == 42); // sum(item_i)
+    assertEquals(2015, (long) tuple.getLong("year_i"));

Review Comment:
   `2015L` ?



##########
solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/MathExpressionTest.java:
##########
@@ -1719,10 +1719,10 @@ public void testMatrix() throws Exception {
     assertEquals(features.get(0).get(0), "col3");
     assertEquals(features.get(1).get(0), "col1");
 
-    assertTrue(tuples.get(0).getLong("f") == 2);
-    assertTrue(tuples.get(0).getLong("g") == 3);
-    assertTrue(tuples.get(0).getLong("h") == 1);
-    assertTrue(tuples.get(0).getLong("i") == 2);
+    assertEquals(2, (long) tuples.get(0).getLong("f"));

Review Comment:
   let me know if cast is avoidable 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org