@Test
public void should_handle_serialization_of_a_contract_with_data_references() throws Exception {

    Contract aSimpleContractWithDataRef = aSimpleContractWithDataRef(EditMode.EDIT);
    byte[] serializedContract = new ObjectMapper().writeValueAsBytes(aSimpleContractWithDataRef);
    ContractDeserializer contractDeserializer = new ContractDeserializer();
    Contract contract = contractDeserializer.deserialize(new JsonFactory(new ObjectMapper()).createParser(serializedContract), null);
    assertThat(contract.getInput()).extracting("name", "type","dataReference").containsExactly(
            tuple("employeeInput", NodeContractInput.class.getName(),new BusinessDataReference("employee","org.test.Employee",RelationType.COMPOSITION,LoadingType.EAGER)));
    assertThat(find(contract.getInput(), instanceOf(NodeContractInput.class)).getInput()).extracting("name", "type").containsExactly(
            tuple("firstName", String.class.getName()),
            tuple("lastName", String.class.getName()),
            tuple("birthDate", LocalDate.class.getName()),
            tuple("manager", NodeContractInput.class.getName()),
            tuple("addresses", NodeContractInput.class.getName()));
}