@Test
 public void bindDoesNotNullPointerExceptionForViews() {
   names.set(null);
   binder.bind(names).to(panel, viewFactory);
   names.set(Copy.list("one"));
   assertThat(panel.getWidgetCount(), is(1));
 }
 @Test
 public void newNamesAreAddedToPanel() {
   binder.bind(names).to(panel, viewFactory);
   assertThat(panel.getWidgetCount(), is(0));
   names.add("one");
   assertLabel(panel.getIsWidget(0), "one");
 }
 @Test
 public void newNamesAreAddedAfterExistingContent() {
   panel.add(viewFactory.create("existing"));
   binder.bind(names).to(panel, viewFactory);
   names.add("one");
   assertLabel(panel.getIsWidget(0), "existing");
   assertLabel(panel.getIsWidget(1), "one");
 }
 @Test
 public void newNamesAreAddedWithIndexToPanel() {
   binder.bind(names).to(panel, viewFactory);
   names.add("one");
   assertLabel(panel.getIsWidget(0), "one");
   names.add(0, "two");
   assertLabel(panel.getIsWidget(0), "two");
 }
 @Test
 public void initialNamesAreAddedToPanel() {
   names.add("one");
   names.add("two");
   binder.bind(names).to(panel, viewFactory);
   assertLabel(panel.getIsWidget(0), "one");
   assertLabel(panel.getIsWidget(1), "two");
 }
 @Test
 public void bindDoesNotNullPointerExceptionForPresenters() {
   names.set(null);
   ParentPresenter parent = bind(new ParentPresenter());
   binder.bind(names).to(parent, panel, presenterFactory);
   names.set(Copy.list("one"));
   assertThat(panel.getWidgetCount(), is(1));
 }
 @Test
 public void newPresentersAreAddedToPanel() {
   binder.bind(names).to(parent, panel, presenterFactory);
   assertThat(panel.getWidgetCount(), is(0));
   names.add("one");
   assertLabel(panel.getIsWidget(0), "one");
   assertThat(parent.getChildren().size(), is(1));
 }
 @Test
 public void initialPresentersAreAddedToPanel() {
   names.add("one");
   names.add("two");
   binder.bind(names).to(parent, panel, presenterFactory);
   assertLabel(panel.getIsWidget(0), "one");
   assertLabel(panel.getIsWidget(1), "two");
   assertThat(parent.getChildren().size(), is(2));
 }
 @Test
 public void oldNamesAreRemovedFromPanel() {
   binder.bind(names).to(panel, viewFactory);
   names.add("one");
   names.add("two");
   assertThat(panel.getWidgetCount(), is(2));
   names.remove("one");
   assertThat(panel.getWidgetCount(), is(1));
   assertLabel(panel.getIsWidget(0), "two");
 }
 @Test
 public void oldPresentersAreRemovedFromPanel() {
   binder.bind(names).to(parent, panel, presenterFactory);
   names.add("one");
   names.add("two");
   assertThat(panel.getWidgetCount(), is(2));
   assertThat(parent.getChildren().size(), is(2));
   names.remove("one");
   assertThat(panel.getWidgetCount(), is(1));
   assertLabel(panel.getIsWidget(0), "two");
   assertThat(parent.getChildren().size(), is(1));
 }
  @Test
  public void reordersToDoNotRequireCreatingNewPresenters() {
    binder.bind(names).to(parent, panel, presenterFactory);
    names.set(list("one", "two"));
    assertThat(panel.getWidgetCount(), is(2));
    assertLabel(panel.getIsWidget(0), "one");
    assertThat(presenterFactory.created, is(2));

    names.set(list("two", "one"));
    assertThat(panel.getWidgetCount(), is(2));
    assertLabel(panel.getIsWidget(0), "two");
    assertThat(presenterFactory.created, is(2));
  }