147148149150151152153154155156
} @Test public void getWhereStringForFilter_between() { StatementHelper sh = mockedStatementHelper(18, 65); Between f = new Between("AGE", 18, 65); Assert.assertEquals("\"AGE\" BETWEEN ? AND ?", QueryBuilder.getWhereStringForFilter(f, sh)); EasyMock.verify(sh); }
2425262728293031
} @Test public void passesFilter_valueIsInRange_shouldBeTrue() { Item item = itemWithPropertyValue("foo", 15); Between between = new Between("foo", 1, 30); Assert.assertTrue(between.passesFilter("foo", item)); }
3132333435363738
} @Test public void passesFilter_valueIsOutOfRange_shouldBeFalse() { Item item = itemWithPropertyValue("foo", 15); Between between = new Between("foo", 0, 2); Assert.assertFalse(between.passesFilter("foo", item)); }
3839404142434445
} @Test public void passesFilter_valueNotComparable_shouldBeFalse() { Item item = itemWithPropertyValue("foo", new Object()); Between between = new Between("foo", 0, 2); Assert.assertFalse(between.passesFilter("foo", item)); }
4445464748495051
Assert.assertFalse(between.passesFilter("foo", item)); } @Test public void appliesToProperty_differentProperties_shoudlBeFalse() { Between between = new Between("foo", 0, 2); Assert.assertFalse(between.appliesToProperty("bar")); }
5051525354555657
Assert.assertFalse(between.appliesToProperty("bar")); } @Test public void appliesToProperty_sameProperties_shouldBeTrue() { Between between = new Between("foo", 0, 2); Assert.assertTrue(between.appliesToProperty("foo")); }
565758596061626364
Assert.assertTrue(between.appliesToProperty("foo")); } @Test public void hashCode_equalInstances_shouldBeEqual() { Between b1 = new Between("foo", 0, 2); Between b2 = new Between("foo", 0, 2); Assert.assertEquals(b1.hashCode(), b2.hashCode()); }
636465666768697071
Assert.assertEquals(b1.hashCode(), b2.hashCode()); } @Test public void equals_differentObjects_shouldBeFalse() { Between b1 = new Between("foo", 0, 2); Object obj = new Object(); Assert.assertFalse(b1.equals(obj)); }
707172737475767778
Assert.assertFalse(b1.equals(obj)); } @Test public void equals_sameInstance_shouldBeTrue() { Between b1 = new Between("foo", 0, 2); Between b2 = b1; Assert.assertTrue(b1.equals(b2)); }
777879808182838485
Assert.assertTrue(b1.equals(b2)); } @Test public void equals_equalInstances_shouldBeTrue() { Between b1 = new Between("foo", 0, 2); Between b2 = new Between("foo", 0, 2); Assert.assertTrue(b1.equals(b2)); }