You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2016/07/28 21:27:12 UTC
[05/11] activemq-artemis git commit: Fix CCE in UnaryExpression.equals
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� <vi...@iki.fi>
Authored: Thu Jul 28 21:29:57 2016 +0300
Committer: Ville Skytt� <vi...@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);
+ }
+}