The test case below is about a single add - probably more issues with other modifications of underlying list, too lazy to go for a hunt
/**
* Change incorrect on add.
*/
@Test
public void testFilteredNotificationAdd() {
ObservableList<Integer> original = FXCollections.observableArrayList(
0, 1, 2, 3, 4 ,5, 6, 7, 8, 9
);
FilteredList list = new FilteredList(original, new Always());
final ObjectProperty<Change> change = new ObjectProperty<Change>();
ListChangeListener l = new ListChangeListener() {
@Override
public void onChanged(Change c) {
change.set(c);
}
};
list.addListener(l);
original.add(20);
assertEquals("from", list.size() - 1, change.get().getFrom());
assertEquals("to", list.size(), change.get().getTo());
assertEquals("added", true, change.get().wasAdded());
}