From 7eec9727814d09a56b506b45058474ab88cbd750 Mon Sep 17 00:00:00 2001 From: Igor Dianov Date: Sat, 26 Nov 2022 08:40:25 -0800 Subject: [PATCH] fix: add test to assert correct content length is set --- .../content/rest/controllers/StoreRestEndpointsIT.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spring-content-rest/src/test/java/it/internal/org/springframework/content/rest/controllers/StoreRestEndpointsIT.java b/spring-content-rest/src/test/java/it/internal/org/springframework/content/rest/controllers/StoreRestEndpointsIT.java index 9cb2c3eb7..576f1f413 100644 --- a/spring-content-rest/src/test/java/it/internal/org/springframework/content/rest/controllers/StoreRestEndpointsIT.java +++ b/spring-content-rest/src/test/java/it/internal/org/springframework/content/rest/controllers/StoreRestEndpointsIT.java @@ -33,6 +33,7 @@ import static com.github.paulcwarren.ginkgo4j.Ginkgo4jDSL.Describe; import static com.github.paulcwarren.ginkgo4j.Ginkgo4jDSL.FIt; import static com.github.paulcwarren.ginkgo4j.Ginkgo4jDSL.It; +import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; @@ -94,6 +95,7 @@ public class StoreRestEndpointsIT { assertThat(IOUtils.contentEquals( new ByteArrayInputStream("New multi-part content".getBytes()), r.getInputStream()), is(true)); + assertThat(r.contentLength(), equalTo(Long.valueOf(content.length()))); }); }); Context("given a DELETE request to that path", () -> { @@ -159,6 +161,7 @@ public class StoreRestEndpointsIT { new ByteArrayInputStream( "New multi-part content".getBytes()), r.getInputStream()), is(true)); + assertThat(r.contentLength(), equalTo(Long.valueOf(content.length()))); }); }); It("should delete the resource", () -> { @@ -234,6 +237,7 @@ public class StoreRestEndpointsIT { new ByteArrayInputStream( "New multi-part content".getBytes()), r.getInputStream()), is(true)); + assertThat(r.contentLength(), equalTo(Long.valueOf(content.length()))); }); }); It("should delete the resource", () -> {