use of ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteria in project wicket-orientdb by OrienteerBAP.
the class TestFilters method testEqualsFilterCriteria.
@Test
@SuppressWarnings("unchecked")
public void testEqualsFilterCriteria() {
IFilterCriteriaManager manager = new FilterCriteriaManager(wicket.getProperty(NUMBER_FIELD));
IFilterCriteria equalsFilterCriteria = manager.createEqualsFilterCriteria(Model.of(NUM_VALUE_1), Model.of(true));
manager.addFilterCriteria(equalsFilterCriteria);
String numField = wicket.getProperty(NUMBER_FIELD).getObject().getName();
queryModel.addFilterCriteriaManager(numField, manager);
assertTrue(queryModel.getObject().size() == 1);
assertTrue(queryModel.getObject().get(0).field(NUMBER_FIELD).equals(NUM_VALUE_1));
queryModel.detach();
manager = new FilterCriteriaManager(wicket.getProperty(STRING_FIELD));
equalsFilterCriteria = manager.createEqualsFilterCriteria(Model.of(STR_VALUE_1), Model.of(true));
manager.addFilterCriteria(equalsFilterCriteria);
String strField = wicket.getProperty(STRING_FIELD).getObject().getName();
queryModel.addFilterCriteriaManager(strField, manager);
assertTrue(queryModel.getObject().size() == 1);
assertTrue(queryModel.getObject().get(0).field(STRING_FIELD).equals(STR_VALUE_1));
}
Aggregations