cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Jirsa (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-13799) Fix some alerts raised by lgtm.com
Date Fri, 20 Oct 2017 02:25:00 GMT

    [ https://issues.apache.org/jira/browse/CASSANDRA-13799?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16212068#comment-16212068
] 

Jeff Jirsa commented on CASSANDRA-13799:
----------------------------------------

Thanks again for the patch, [~malcolmt] ! There's a few minor changes I'd like to make if
you're ok with them:


{code}
diff --git a/test/unit/org/apache/cassandra/index/sasi/plan/ExpressionTest.java b/test/unit/org/apache/cassandra/index/sasi/plan/ExpressionTest.java
index c9fdc42..7457a85 100644
--- a/test/unit/org/apache/cassandra/index/sasi/plan/ExpressionTest.java
Fix some alerts raised by lgtm.com
+++ b/test/unit/org/apache/cassandra/index/sasi/plan/ExpressionTest.java
@@ -19,6 +19,7 @@ package org.apache.cassandra.index.sasi.plan;

 import java.nio.ByteBuffer;

+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import org.junit.Test;

@@ -29,12 +30,24 @@ public class ExpressionTest
 {

     @Test
-    public void testBoundHashCode() {
-       ByteBuffer buf1 = UTF8Type.instance.decompose("blah");
-        Bound b1 = new Bound(buf1, true);
+    public void testBoundHashCode()
+    {
+        ByteBuffer buf1 = UTF8Type.instance.decompose("blah");
+        Expression.Bound b1 = new Expression.Bound(buf1, true);
         ByteBuffer buf2 = UTF8Type.instance.decompose("blah");
-        Bound b2 = new Bound(buf2, true);
+        Expression.Bound b2 = new Expression.Bound(buf2, true);
         assertTrue(b1.equals(b2));
         assertTrue(b1.hashCode() == b2.hashCode());
     }
+
+    @Test
+    public void testNotMatchingBoundHashCode()
+    {
+        ByteBuffer buf1 = UTF8Type.instance.decompose("blah");
+        Expression.Bound b1 = new Expression.Bound(buf1, true);
+        ByteBuffer buf2 = UTF8Type.instance.decompose("blah2");
+        Expression.Bound b2 = new Expression.Bound(buf2, true);
+        assertFalse(b1.equals(b2));
+        assertFalse(b1.hashCode() == b2.hashCode());
+    }
 }
{code}

Pushing to CI: 

unit test: https://circleci.com/gh/jeffjirsa/cassandra/tree/cassandra-13799
dtest: https://builds.apache.org/view/A-D/view/Cassandra/job/Cassandra-devbranch-dtest/386/


> Fix some alerts raised by lgtm.com
> ----------------------------------
>
>                 Key: CASSANDRA-13799
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13799
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: Malcolm Taylor
>            Assignee: Malcolm Taylor
>             Fix For: 4.x
>
>         Attachments: 13799-trunk.txt
>
>
> lgtm.com has identified a number of issues  where there may be scope for improving the
code ([https://lgtm.com/projects/g/apache/cassandra/alerts/?mode=tree&severity=error]).
This issue is to address some of the more straightforward cases.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message