use of org.apache.wicket.model.util.CollectionModel in project wicket-orientdb by OrienteerBAP.
the class TestFilters method testCollectionFilterCriteria.
@Test
@SuppressWarnings("unchecked")
public void testCollectionFilterCriteria() {
List<Integer> models = Lists.newArrayList();
models.add(NUM_VALUE_1);
models.add(NUM_VALUE_2);
IModel<Collection<Integer>> collectionModel = new CollectionModel<>(models);
IFilterCriteriaManager manager = new FilterCriteriaManager(wicket.getProperty(NUMBER_FIELD));
manager.addFilterCriteria(manager.createCollectionFilterCriteria(collectionModel, Model.of(true)));
String field = wicket.getProperty(NUMBER_FIELD).getObject().getName();
queryModel.addFilterCriteriaManager(field, manager);
queryModel.setSort(NUMBER_FIELD, SortOrder.ASCENDING);
assertTrue(queryModel.getObject().size() == 2);
assertTrue(queryModel.getObject().get(0).field(NUMBER_FIELD).equals(NUM_VALUE_1));
assertTrue(queryModel.getObject().get(1).field(NUMBER_FIELD).equals(NUM_VALUE_2));
}
Aggregations