diff options
author | Artur Signell <artur@vaadin.com> | 2015-01-26 19:34:36 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2015-01-26 19:35:10 +0200 |
commit | 8f056dd0317b3dc3e475fd7220a89021bb3166dc (patch) | |
tree | 3fed6f2a690de0d54ab1bd87ea8bf91e5a665d0a /server/tests/src/com | |
parent | a6a3060fb21441cf9925f70c5ff4fed327b47ca6 (diff) | |
parent | 17a9993995cfd3434259cd8b0f729f76da36de12 (diff) | |
download | vaadin-framework-8f056dd0317b3dc3e475fd7220a89021bb3166dc.tar.gz vaadin-framework-8f056dd0317b3dc3e475fd7220a89021bb3166dc.zip |
Merge remote-tracking branch 'origin/master' into HEAD
Change-Id: I42718fcc8a07ca46f7e58016d3caf287ce88e3ed
Diffstat (limited to 'server/tests/src/com')
-rw-r--r-- | server/tests/src/com/vaadin/data/util/sqlcontainer/filters/BetweenTest.java | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/server/tests/src/com/vaadin/data/util/sqlcontainer/filters/BetweenTest.java b/server/tests/src/com/vaadin/data/util/sqlcontainer/filters/BetweenTest.java index 16171f67bc..6daf730e25 100644 --- a/server/tests/src/com/vaadin/data/util/sqlcontainer/filters/BetweenTest.java +++ b/server/tests/src/com/vaadin/data/util/sqlcontainer/filters/BetweenTest.java @@ -118,4 +118,65 @@ public class BetweenTest { Between b2 = new Between("bar", 0, 1); Assert.assertFalse(b1.equals(b2)); } + + @Test + public void hashCode_nullStartValue_shouldBeEqual() { + Between b1 = new Between("foo", null, 2); + Between b2 = new Between("foo", null, 2); + Assert.assertEquals(b1.hashCode(), b2.hashCode()); + } + + @Test + public void hashCode_nullEndValue_shouldBeEqual() { + Between b1 = new Between("foo", 0, null); + Between b2 = new Between("foo", 0, null); + Assert.assertEquals(b1.hashCode(), b2.hashCode()); + } + + @Test + public void hashCode_nullPropertyId_shouldBeEqual() { + Between b1 = new Between(null, 0, 2); + Between b2 = new Between(null, 0, 2); + Assert.assertEquals(b1.hashCode(), b2.hashCode()); + } + + @Test + public void passesFilter_nullValue_filterIsPassed() { + String id = "id"; + Between between = new Between(id, null, null); + Assert.assertTrue(between.passesFilter(id, + itemWithPropertyValue(id, null))); + } + + @Test + public void passesFilter_nullStartValue_filterIsPassed() { + String id = "id"; + Between between = new Between(id, null, 2); + Assert.assertTrue(between + .passesFilter(id, itemWithPropertyValue(id, 1))); + } + + @Test + public void passesFilter_nullEndValue_filterIsPassed() { + String id = "id"; + Between between = new Between(id, 0, null); + Assert.assertTrue(between + .passesFilter(id, itemWithPropertyValue(id, 1))); + } + + @Test + public void passesFilter_nullStartValueAndEndValue_filterIsPassed() { + String id = "id"; + Between between = new Between(id, null, null); + Assert.assertTrue(between + .passesFilter(id, itemWithPropertyValue(id, 1))); + } + + @Test + public void passesFilter_nullStartValueAndEndValueAndValueIsNotComparable_filterIsNotPassed() { + String id = "id"; + Between between = new Between(id, null, null); + Assert.assertFalse(between.passesFilter(id, + itemWithPropertyValue(id, new Object()))); + } } |