@Test
public void should_create_single_document_to_edit() {

    ContractInputToWidgetMapper contractInputToWidgetMapper = makeContractInputToWidgetMapper();
    LeafContractInput fileContractInput = ContractInputBuilder.aFileContractInput("aDocument.txt");
    ContractInputDataHandler dataHandler = new ContractInputDataHandler(fileContractInput);
    assertThat(dataHandler.isDocumentEdition()).isFalse();
    fileContractInput.setDataReference(new DataReference("myDoc", File.class.getName()));
    fileContractInput.setMode(EditMode.EDIT);
    assertThat(dataHandler.isDocumentEdition()).isTrue();
    Container container = (Container) contractInputToWidgetMapper.toDocument(fileContractInput);
    Component titleComponent = (Component) container.getRows().get(0).get(0);
    assertThat(titleComponent.getId()).isEqualTo("pbTitle");
    PropertyValue textProperty = titleComponent.getPropertyValues().get("text");
    assertThat(textProperty.getValue()).isEqualTo("My Doc");
    Component fileViewerComponent = (Component) container.getRows().get(1).get(0);
    assertThat(fileViewerComponent.getId()).isEqualTo("pbFileViewer");
    PropertyValue documentProperty = fileViewerComponent.getPropertyValues().get("document");
    assertThat(documentProperty.getValue()).isEqualTo("context.myDoc_ref");
    Component fileUploadComponent = (Component) container.getRows().get(2).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("context.myDoc_ref.newValue");
}