activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [05/11] activemq-artemis git commit: Fix CCE in UnaryExpression.equals
Date Thu, 28 Jul 2016 21:27:12 GMT
Fix CCE in UnaryExpression.equals


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/d0920993
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/d0920993
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/d0920993

Branch: refs/heads/master
Commit: d09209936a3185bd89e30a0983ff171741b0e0e8
Parents: 2ec6a6d
Author: Ville Skyttä <ville.skytta@iki.fi>
Authored: Thu Jul 28 21:29:57 2016 +0300
Committer: Ville Skyttä <ville.skytta@iki.fi>
Committed: Thu Jul 28 23:30:02 2016 +0300

----------------------------------------------------------------------
 .../selector/filter/UnaryExpression.java        |  2 +-
 .../selector/filter/UnaryExpressionTest.java    | 33 ++++++++++++++++++++
 2 files changed, 34 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/d0920993/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/UnaryExpression.java
----------------------------------------------------------------------
diff --git a/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/UnaryExpression.java
b/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/UnaryExpression.java
index 3121ac2..e0853c6 100755
--- a/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/UnaryExpression.java
+++ b/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/UnaryExpression.java
@@ -262,7 +262,7 @@ public abstract class UnaryExpression implements Expression {
          return false;
       }
 
-      final BinaryExpression that = (BinaryExpression) o;
+      final UnaryExpression that = (UnaryExpression) o;
 
       if (!this.getExpressionSymbol().equals(that.getExpressionSymbol())) {
          return false;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/d0920993/artemis-selector/src/test/java/org/apache/activemq/artemis/selector/filter/UnaryExpressionTest.java
----------------------------------------------------------------------
diff --git a/artemis-selector/src/test/java/org/apache/activemq/artemis/selector/filter/UnaryExpressionTest.java
b/artemis-selector/src/test/java/org/apache/activemq/artemis/selector/filter/UnaryExpressionTest.java
new file mode 100755
index 0000000..6e6ab43
--- /dev/null
+++ b/artemis-selector/src/test/java/org/apache/activemq/artemis/selector/filter/UnaryExpressionTest.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.selector.filter;
+
+import org.apache.activemq.artemis.selector.impl.SelectorParser;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class UnaryExpressionTest {
+
+   @Test
+   public void testEquals() throws Exception {
+      BooleanExpression expr1 = UnaryExpression.createNOT(SelectorParser.parse("x = 1"));
+      BooleanExpression expr2 = UnaryExpression.createNOT(SelectorParser.parse("x = 1"));
+      Assert.assertTrue("Created unary expression 1", expr1 instanceof UnaryExpression);
+      Assert.assertTrue("Created unary expression 2", expr2 instanceof UnaryExpression);
+      Assert.assertEquals("Unary expressions are equal", expr1, expr2);
+   }
+}


Mime
View raw message