|
28 | 28 | import java.util.stream.Collectors; |
29 | 29 | import java.util.stream.Stream; |
30 | 30 |
|
| 31 | +import org.junit.Assert; |
| 32 | +import org.junit.Before; |
| 33 | +import org.junit.Rule; |
| 34 | +import org.junit.Test; |
| 35 | +import org.junit.rules.ExpectedException; |
| 36 | +import org.mockito.Mockito; |
| 37 | + |
| 38 | +import com.vaadin.flow.component.Component; |
31 | 39 | import com.vaadin.flow.component.ComponentEventListener; |
32 | 40 | import com.vaadin.flow.component.Tag; |
33 | 41 | import com.vaadin.flow.function.SerializableBiConsumer; |
34 | 42 | import com.vaadin.flow.function.SerializableComparator; |
35 | 43 | import com.vaadin.flow.function.SerializablePredicate; |
| 44 | +import com.vaadin.flow.function.SerializableSupplier; |
36 | 45 | import com.vaadin.flow.function.ValueProvider; |
37 | 46 | import com.vaadin.flow.shared.Registration; |
38 | 47 | import com.vaadin.flow.tests.data.bean.Item; |
39 | | -import org.junit.Assert; |
40 | | -import org.junit.Before; |
41 | | -import org.junit.Rule; |
42 | | -import org.junit.Test; |
43 | | -import org.junit.rules.ExpectedException; |
44 | 48 |
|
45 | | -import com.vaadin.flow.component.Component; |
46 | | -import com.vaadin.flow.function.SerializableSupplier; |
47 | | -import org.mockito.Mockito; |
| 49 | +import static com.vaadin.flow.tests.server.ClassesSerializableUtils.serializeAndDeserialize; |
| 50 | +import static org.junit.Assert.assertNotNull; |
48 | 51 |
|
49 | 52 | public class AbstractListDataViewTest { |
50 | 53 |
|
@@ -1299,6 +1302,18 @@ public void filterOrSortingChangedCallback_emptyCallbackProvided_throws() { |
1299 | 1302 | new ListDataViewImpl(() -> dataProvider, component, null); |
1300 | 1303 | } |
1301 | 1304 |
|
| 1305 | + @Test |
| 1306 | + public void addFilter_serialize_dataViewSerializable() throws Throwable { |
| 1307 | + DataViewUtils.setComponentFilter(component, term -> true); |
| 1308 | + ListDataProvider<String> dp = DataProvider.ofCollection(Set.of("A")); |
| 1309 | + ListDataViewImpl listDataView = new ListDataViewImpl(() -> dp, |
| 1310 | + component, (filter, sort) -> { |
| 1311 | + }); |
| 1312 | + listDataView.addFilter(term -> true); |
| 1313 | + ListDataViewImpl out = serializeAndDeserialize(listDataView); |
| 1314 | + assertNotNull(out); |
| 1315 | + } |
| 1316 | + |
1302 | 1317 | private static class ListDataViewImpl extends AbstractListDataView<String> { |
1303 | 1318 |
|
1304 | 1319 | private final AtomicInteger refreshCount = new AtomicInteger(0); |
|
0 commit comments