@Test
public void should_create_multiple_document_to_edit_container() {

    ContractInputToWidgetMapper contractInputToWidgetMapper = makeContractInputToWidgetMapper();
    LeafContractInput fileContractInput = ContractInputBuilder.aFileContractInput("aDocument.txt");
    fileContractInput.setMultiple(true);
    fileContractInput.setMode(EditMode.EDIT);
    ContractInputDataHandler dataHandler = new ContractInputDataHandler(fileContractInput);
    fileContractInput.setDataReference(new DataReference("myDoc", File.class.getName()));
    assertThat(dataHandler.isDocumentEdition()).isTrue();
    Element element = contractInputToWidgetMapper.toDocument(fileContractInput);
    assertThat(element).isInstanceOf(Container.class);
    Container container = (Container) element;
    assertThat(container.getRows()).hasSize(2);
    assertThat(container.isRepeated()).isFalse();
    Component title = (Component) container.getRows().get(0).get(0);
    assertThat(title.getId()).isEqualTo("pbTitle");
    Container multipleContainer = (Container) container.getRows().get(1).get(0);
    Map<String, PropertyValue> propertyValues = multipleContainer.getPropertyValues();
    PropertyValue repeatedCollectionProperty = propertyValues.get("repeatedCollection");
    assertThat(repeatedCollectionProperty.getValue()).isEqualTo("context.myDoc_ref");
    Component fileViewerComponent = (Component) multipleContainer.getRows().get(0).get(0);
    assertThat(fileViewerComponent.getId()).isEqualTo("pbFileViewer");
    PropertyValue documentProperty = fileViewerComponent.getPropertyValues().get("document");
    assertThat(documentProperty.getValue()).isEqualTo("$item");
    Component fileUploadComponent = (Component) multipleContainer.getRows().get(1).get(0);
    assertThat(fileUploadComponent.getId()).isEqualTo("pbUpload");
    PropertyValue labelHiddenProperty = fileUploadComponent.getPropertyValues().get("labelHidden");
    assertThat(labelHiddenProperty.getValue()).isEqualTo(Boolean.TRUE);
    PropertyValue valueProperty = fileUploadComponent.getPropertyValues().get("value");
    assertThat(valueProperty.getValue()).isEqualTo("$item.newValue");
}