@Test
public void mapBindingsUpdateDestinationList() throws Exception {

  BindingsManager bindings = new BindingsManager(BatchInvoker.INVOKE_IMMEDIATELY_STRATEGY);
  ObservableList<Integer> numericList = new ObservableList<>();
  for (int i = 1; i <= 5; i++) {
    numericList.add(i);
  }
  ObservableList<String> stringList = new ObservableList<>();
  CountListener listener = new CountListener();
  stringList.addListener(listener);
  bindings.bind(stringList, new MapExpression<Integer, String>(numericList) {
    @NotNull
    @Override
    protected String transform(@NotNull Integer srcElement) {
      return srcElement.toString();
    }
  });
  assertThat(stringList).containsExactly("1", "2", "3", "4", "5");
  assertThat(listener.getCount()).isEqualTo(1);
  numericList.addAll(Arrays.asList(6, 7));
  assertThat(stringList).containsExactly("1", "2", "3", "4", "5", "6", "7");
  assertThat(listener.getCount()).isEqualTo(2);
  numericList.clear();
  assertThat(stringList).isEmpty();
  assertThat(listener.getCount()).isEqualTo(3);
}