private Query<StrBean, SerializablePredicate<StrBean>> createQuery(
List<SortOrder<String>> sortOrder, Comparator<StrBean> comp,
SerializablePredicate<StrBean> filter) {
- return new Query<StrBean, SerializablePredicate<StrBean>>(0,
+ return new Query<>(0,
Integer.MAX_VALUE, sortOrder, comp, filter);
}
Assert.assertEquals("Unexpected number of matches for 'Foo'", 36,
dataProvider.size(new Query<>(fooFilter)));
}
-
- @Test
- public void filteringListDataProvider_defaultFilter() {
- // Intentionally lost filter type. Not actually filterable anymore.
- DataProvider<StrBean, ?> filtered = dataProvider.setFilter(gt5Filter);
-
- Assert.assertEquals("Filter not applied, unexpected item count",
- dataProvider.size(new Query<>(gt5Filter)),
- filtered.size(new Query<>()));
-
- Assert.assertEquals("Further filtering succeeded",
- filtered.size(new Query<>()),
- filtered.size((Query) new Query<>(fooFilter)));
- }
}
public void filteringListDataProvider_appliedFilters() {
Assert.assertEquals("Filtering result differ",
data.stream().filter(fooFilter).count(),
- dataProvider.applyFilter(fooFilter).size(new Query<>()));
+ dataProvider.withFilter(fooFilter).size(new Query<>()));
Assert.assertEquals("Chained filtering result differ",
data.stream().filter(fooFilter.and(gt5Filter)).count(),
- dataProvider.applyFilter(fooFilter)
+ dataProvider.withFilter(fooFilter)
.size(new Query<>(gt5Filter)));
}
public void filteringListDataProvider_chainedFilters() {
Assert.assertEquals("Chained filtering result differ",
data.stream().filter(fooFilter.and(gt5Filter)).count(),
- dataProvider.applyFilter(fooFilter).applyFilter(gt5Filter)
+ dataProvider.withFilter(fooFilter).withFilter(gt5Filter)
.size(new Query<>()));
}
Assert.assertEquals("Chained filtering result differ",
data.stream().filter(fooFilter.or(gt5Filter)).count(),
- orFilteredDataProvider.applyFilter(fooFilter)
- .applyFilter(gt5Filter).size(new Query<>()));
+ orFilteredDataProvider.withFilter(fooFilter)
+ .withFilter(gt5Filter).size(new Query<>()));
}
@Test
public void filteringListDataProvider_appliedFilterAndConverter() {
Assert.assertEquals("Filtering result differ with 'Foo'",
data.stream().filter(gt5Filter.and(fooFilter)).count(),
- dataProvider.applyFilter(gt5Filter).convertFilter(
+ dataProvider.withFilter(gt5Filter).convertFilter(
text -> strBean -> strBean.getValue().equals(text))
.size(new Query<>("Foo")));
Assert.assertEquals("Filtering result differ with 'Xyz'", data.stream()
.filter(gt5Filter.and(s -> s.getValue().equals("Xyz"))).count(),
- dataProvider.applyFilter(gt5Filter).convertFilter(
+ dataProvider.withFilter(gt5Filter).convertFilter(
text -> strBean -> strBean.getValue().equals(text))
.size(new Query<>("Xyz")));
Assert.assertEquals("No results should've been found", 0,
- dataProvider.applyFilter(gt5Filter).convertFilter(
+ dataProvider.withFilter(gt5Filter).convertFilter(
text -> strBean -> strBean.getValue().equals(text))
.size(new Query<>("Zyx")));
}