@Test
public void add_a_component_embedded_in_a_container_with_buttons_when_visiting_a_multiple_leaf_contract_input()
        throws Exception {

    Page page = new Page();
    new ContractInputVisitorImpl(page, contractInputToWidgetMapper)
            .visit((LeafContractInput) ContractInputBuilder.aContractInput("names").mulitple().build());
    assertThat(page.getRows()).hasSize(3);//one for the container label, one for the container, one for the button bar
    List<Element> firstRow = page.getRows().get(0);
    assertThat(firstRow).hasSize(1);
    assertThat(firstRow.get(0)).isInstanceOf(Component.class);
    assertThat(((Component) firstRow.get(0)).getId()).isEqualTo("pbTitle");
    assertThat(firstRow.get(0).getPropertyValues()).contains(
            entry(ParameterConstants.TEXT_PARAMETER, aInterpolationPropertyValue("Names")));
    List<Element> secondRow = page.getRows().get(1);
    assertThat(secondRow).hasSize(1);
    assertThat(secondRow.get(0)).isInstanceOf(Container.class);
    Container container = (Container) secondRow.get(0);
    assertThat(container.getRows()).hasSize(1);
    List<Element> secondRowInner = container.getRows().get(0);
    assertThat(secondRowInner).hasSize(2);
    Component component = (Component) secondRowInner.get(0);
    assertThat(component.getId()).isEqualTo("pbInput");
    assertThat(component.getPropertyValues()).contains(
            entry(ParameterConstants.LABEL_PARAMETER, aInterpolationPropertyValue("")));
    Component removeButton = (Component) secondRowInner.get(1);
    assertThat(removeButton.getId()).isEqualTo("pbButton");
    List<Element> thirdRow = page.getRows().get(2);
    assertThat(thirdRow).hasSize(1);
    Component addButton = (Component) thirdRow.get(0);
    assertThat(addButton.getId()).isEqualTo("pbButton");
    assertThat(addButton.getPropertyValues().get("valueToAdd").getValue()).isNull();
}