@Test
  public void shouldGracefullyHandleNonExistingColumnsDefinition() {
    ValidationFieldFactoryWrapper wrapper =
        new ValidationFieldFactoryWrapper(databaseContainer, delegateMock, null);

    containerReturnsPropertyWithFieldNullable(true);

    Field<?> field = wrapper.createField(containerMock, 1, "test", uiContextMock);

    verify(field).isRequired();
  }
  @Test
  public void shouldDelegateRequestsToBackingFactory() {
    createTestColumn("test", null);

    containerReturnsPropertyWithFieldNullable(true);

    ValidationFieldFactoryWrapper wrapper =
        new ValidationFieldFactoryWrapper(databaseContainer, delegateMock, tableColumns);

    Field<?> field = wrapper.createField(containerMock, 1, "test", uiContextMock);

    verify(delegateMock).createField(containerMock, 1, "test", uiContextMock);
    assertEquals(comboBoxMock, field);
  }
  @Test
  public void shouldAddValidatorsFromContainer() {
    createTestColumn("test", null);

    containerReturnsPropertyWithFieldNullable(false);

    ValidationFieldFactoryWrapper wrapper =
        new ValidationFieldFactoryWrapper(databaseContainer, delegateMock, tableColumns);

    Field<?> field = wrapper.createField(containerMock, 1, "test", uiContextMock);

    verify(field).setRequired(true);
    verify(field).setRequiredError("Es wird eine Eingabe im Feld test benötigt");
    verify((AbstractSelect) field).setNullSelectionAllowed(false);
  }
  @Test
  public void shouldReturnNullWhenNoFieldIsGivenBackByDelegate() {
    // final Validator vaadinValidator = new NullValidator("Fehler", false);

    createTestColumn(
        "test2",
        Arrays.asList(
            (FieldValidator)
                new FieldValidator() {
                  @Override
                  public void apply(@SuppressWarnings("rawtypes") Field field) {
                    fail("Should not be called");
                  }
                }));

    ValidationFieldFactoryWrapper wrapper =
        new ValidationFieldFactoryWrapper(databaseContainer, delegateMock, tableColumns);

    Field<?> field = wrapper.createField(containerMock, 1, "test2", uiContextMock);

    assertNull(field);
  }
  @Test
  public void shouldAddValidatorsFromTableColumns() {
    final Validator vaadinValidator = new NullValidator("Fehler", false);

    createTestColumn(
        "test",
        Arrays.asList(
            (FieldValidator)
                new FieldValidator() {
                  @Override
                  public void apply(@SuppressWarnings("rawtypes") Field field) {
                    field.addValidator(vaadinValidator);
                  }
                }));

    containerReturnsPropertyWithFieldNullable(true);

    ValidationFieldFactoryWrapper wrapper =
        new ValidationFieldFactoryWrapper(databaseContainer, delegateMock, tableColumns);

    Field<?> field = wrapper.createField(containerMock, 1, "test", uiContextMock);

    verify(field).addValidator(vaadinValidator);
  }