Skip to content

deserialize RepresentationModel is not working in tests #29

@bautrey37

Description

@bautrey37

Cannot deserialize representation model to include links inside. These is useful for inside tests to ensure that HATEOAS works properly with the correct links.

See code to show that it doesn't work. Links is empty array on deserializing on representation model class.

//    mapper.registerModule(new Jackson2HalModule()); // ???

BookItemDTO bookItemDTO1 =
        mapper.readValue(book1.getResponse().getContentAsString(), BookItemDTO.class);
    System.out.println(bookItemDTO1);
    System.out.println(mapper.readValue(book1.getResponse().getContentAsString(), RepresentationModel.class));
//???
    final JavaType entityModelType = mapper.getTypeFactory().constructParametricType(RepresentationModel.class,
                                                                                     BookItemDTO.class );

Conversations in spring-hateoas gitter might be helpful. https://gitter.im/spring-projects/spring-hateoas

As a workaround for now, the DTO will include uuid so that it makes it easy to read and construct the links in the test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions