summaryrefslogtreecommitdiffstats
path: root/server/tests/src/com/vaadin
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2013-11-15 18:49:39 +0200
committerVaadin Code Review <review@vaadin.com>2014-01-21 06:55:45 +0000
commitf0a4ea9c7241885ffd38d5faf38f25a624adac2c (patch)
tree72fb74f47b7c9a46a9f64e98eb44396aa21e2559 /server/tests/src/com/vaadin
parent3f09c10ec3b4982fc725d07f631015b16d8df985 (diff)
downloadvaadin-framework-f0a4ea9c7241885ffd38d5faf38f25a624adac2c.tar.gz
vaadin-framework-f0a4ea9c7241885ffd38d5faf38f25a624adac2c.zip
Do not throw NPE for equals(null) (#8910)
Change-Id: Ie9a658911c9f2722e518dedbe181c24e5ace07db
Diffstat (limited to 'server/tests/src/com/vaadin')
-rw-r--r--server/tests/src/com/vaadin/data/util/sqlcontainer/filters/CompareTest.java44
1 files changed, 44 insertions, 0 deletions
diff --git a/server/tests/src/com/vaadin/data/util/sqlcontainer/filters/CompareTest.java b/server/tests/src/com/vaadin/data/util/sqlcontainer/filters/CompareTest.java
new file mode 100644
index 0000000000..c8faa71e66
--- /dev/null
+++ b/server/tests/src/com/vaadin/data/util/sqlcontainer/filters/CompareTest.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ *
+ * Licensed 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 com.vaadin.data.util.sqlcontainer.filters;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.data.util.filter.Compare;
+
+public class CompareTest {
+
+ @Test
+ public void testEquals() {
+ Compare c1 = new Compare.Equal("prop1", "val1");
+ Compare c2 = new Compare.Equal("prop1", "val1");
+ Assert.assertTrue(c1.equals(c2));
+ }
+
+ @Test
+ public void testDifferentTypeEquals() {
+ Compare c1 = new Compare.Equal("prop1", "val1");
+ Compare c2 = new Compare.Greater("prop1", "val1");
+ Assert.assertFalse(c1.equals(c2));
+ }
+
+ @Test
+ public void testEqualsNull() {
+ Compare c1 = new Compare.Equal("prop1", "val1");
+ Assert.assertFalse(c1.equals(null));
+ }
+}