use of org.opennms.core.criteria.CriteriaBuilder in project opennms by OpenNMS.
the class BeanWrapperVisitorTest method testNotNullFromNullRestriction.
@Test
public void testNotNullFromNullRestriction() {
new CriteriaBuilder(TestBean.class).isNull("string").toCriteria().visit(m_visitor);
assertEquals(0, m_visitor.getMatches().size());
}
use of org.opennms.core.criteria.CriteriaBuilder in project opennms by OpenNMS.
the class BeanWrapperVisitorTest method testFailedGreaterThanWithEqualsComparison.
@Test
public void testFailedGreaterThanWithEqualsComparison() {
new CriteriaBuilder(TestBean.class).gt("four", 4).toCriteria().visit(m_visitor);
assertEquals(0, m_visitor.getMatches().size());
}
use of org.opennms.core.criteria.CriteriaBuilder in project opennms by OpenNMS.
the class BeanWrapperVisitorTest method testGreaterEqual.
@Test
public void testGreaterEqual() {
new CriteriaBuilder(TestBean.class).ge("one", 0.0f).toCriteria().visit(m_visitor);
assertEquals(1, m_visitor.getMatches().size());
m_visitor.reset();
new CriteriaBuilder(TestBean.class).ge("one", 0.99999d).toCriteria().visit(m_visitor);
assertEquals(1, m_visitor.getMatches().size());
m_visitor.reset();
new CriteriaBuilder(TestBean.class).ge("four", 3.9999f).toCriteria().visit(m_visitor);
assertEquals(1, m_visitor.getMatches().size());
}
use of org.opennms.core.criteria.CriteriaBuilder in project opennms by OpenNMS.
the class BeanWrapperVisitorTest method testEnumComparisonLt.
@Test
public void testEnumComparisonLt() {
final BeanWrapperCriteriaVisitor visitor = new BeanWrapperCriteriaVisitor(m_testBean);
new CriteriaBuilder(TestBean.class).lt("enumFirst", CompareMe.FIRST).toCriteria().visit(visitor);
assertEquals(0, visitor.getMatches().size());
visitor.reset();
new CriteriaBuilder(TestBean.class).lt("enumSecond", CompareMe.FIRST).toCriteria().visit(visitor);
assertEquals(0, visitor.getMatches().size());
visitor.reset();
new CriteriaBuilder(TestBean.class).lt("enumFirst", CompareMe.THIRD).toCriteria().visit(visitor);
assertEquals(1, visitor.getMatches().size());
visitor.reset();
new CriteriaBuilder(TestBean.class).lt("enumSecond", CompareMe.THIRD).toCriteria().visit(visitor);
assertEquals(1, visitor.getMatches().size());
visitor.reset();
new CriteriaBuilder(TestBean.class).lt("enumThird", CompareMe.THIRD).toCriteria().visit(visitor);
assertEquals(0, visitor.getMatches().size());
}
use of org.opennms.core.criteria.CriteriaBuilder in project opennms by OpenNMS.
the class BeanWrapperVisitorTest method testFailedLessThanWithGreaterComparison.
@Test
public void testFailedLessThanWithGreaterComparison() {
new CriteriaBuilder(TestBean.class).lt("four", 1d).toCriteria().visit(m_visitor);
assertEquals(0, m_visitor.getMatches().size());
}
Aggregations