Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deserialize RepresentationModel is not working in tests #29

Open
bautrey37 opened this issue Jul 7, 2020 · 0 comments
Open

deserialize RepresentationModel is not working in tests #29

bautrey37 opened this issue Jul 7, 2020 · 0 comments

Comments

@bautrey37
Copy link
Owner

bautrey37 commented Jul 7, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant