@Test
  public void
      should_create_initilal_value_expression_for_given_multiple_business_data_and_generated_contract_input()
          throws Exception {
    final SimpleFieldToContractInputMapping mapping =
        new SimpleFieldToContractInputMapping(SimpleFieldBuilder.aStringField("firstName").build());

    final FieldToContractInputMappingOperationBuilder operationBuilder =
        mock(FieldToContractInputMappingOperationBuilder.class);
    final RepositoryAccessor repositoryAccessor = mock(RepositoryAccessor.class);
    final BusinessObjectModelRepositoryStore businessStore =
        mock(BusinessObjectModelRepositoryStore.class);
    when(repositoryAccessor.getRepositoryStore(BusinessObjectModelRepositoryStore.class))
        .thenReturn(businessStore);
    final FieldToContractInputMappingExpressionBuilder expressionBuilder =
        mock(FieldToContractInputMappingExpressionBuilder.class);
    final RootContractInputGenerator rootContractInputGenerator =
        new RootContractInputGenerator(
            "rootInputName",
            newArrayList(mapping),
            repositoryAccessor,
            operationBuilder,
            expressionBuilder);
    final BusinessObjectData businessObjectData =
        aBusinessData().withName("employee").multiple().build();
    rootContractInputGenerator.build(businessObjectData);

    final ArgumentCaptor<FieldToContractInputMapping> argumentCaptor =
        ArgumentCaptor.forClass(FieldToContractInputMapping.class);
    verify(expressionBuilder).toExpression(eq(businessObjectData), argumentCaptor.capture());
    final FieldToContractInputMapping fieldToContractInputMapping = argumentCaptor.getValue();
    assertThat(fieldToContractInputMapping.getField().getName()).isEqualTo("rootInputName");
    assertThat(fieldToContractInputMapping.getField().isCollection()).isTrue();
    assertThat(fieldToContractInputMapping.getChildren()).hasSize(1);
  }
 public void addChild(final FieldToContractInputMapping child) {
   if (children.add(child)) {
     child.setParent(this);
   }
 }