From 94dec6bfefebd582e8d78a8957762cb5680a23e2 Mon Sep 17 00:00:00 2001 From: Oliver Drotbohm Date: Fri, 8 Oct 2021 11:02:55 +0200 Subject: [PATCH] Adapt to removed deprecations in Spring HATEOAS 1.4. Fixes #2072. --- .../rest/webmvc/json/PersistentEntitySerializationTests.java | 4 ++-- .../rest/webmvc/json/PersistentEntitySerializationTests.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntitySerializationTests.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntitySerializationTests.java index 699982630..07a813fe8 100755 --- a/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntitySerializationTests.java +++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntitySerializationTests.java @@ -200,7 +200,7 @@ public class PersistentEntitySerializationTests { withLink(Link.of("/orders/1")).// build(); - PagedModel persistentEntityResource = new PagedModel( + PagedModel persistentEntityResource = PagedModel.of( Arrays.asList(orderResource), new PageMetadata(1, 0, 10)); String result = mapper.writeValueAsString(persistentEntityResource); @@ -256,7 +256,7 @@ public class PersistentEntitySerializationTests { ProjectionFactory factory = new SpelAwareProxyProjectionFactory(); PersonSummary projection = factory.createProjection(PersonSummary.class, person); - String result = mapper.writeValueAsString(new EntityModel(projection)); + String result = mapper.writeValueAsString(EntityModel.of(projection)); assertThat(JsonPath. read(result, "$._links.self")).isNotNull(); } diff --git a/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntitySerializationTests.java b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntitySerializationTests.java index 5f285a0af..28cee295b 100755 --- a/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntitySerializationTests.java +++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntitySerializationTests.java @@ -107,7 +107,7 @@ public class PersistentEntitySerializationTests { withLink(Link.of("/users/1")).// build(); - PagedModel persistentEntityResource = new PagedModel( + PagedModel persistentEntityResource = PagedModel.of( Arrays.asList(userResource), new PageMetadata(1, 0, 10)); String result = mapper.writeValueAsString(persistentEntityResource);