From 8450c69497dc04e14b5a01484ab087a6c9a1a4c4 Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Tue, 21 Feb 2017 11:24:44 +0100 Subject: [PATCH] Add ListBodySpec.size implementation Added implementation for WebTestClient.ListBodySpec.size(). --- .../test/web/reactive/server/DefaultWebTestClient.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultWebTestClient.java b/spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultWebTestClient.java index e6cc98066e..e1fc6bb3d4 100644 --- a/spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultWebTestClient.java +++ b/spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultWebTestClient.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.test.web.reactive.server; import java.net.URI; @@ -429,6 +430,9 @@ class DefaultWebTestClient implements WebTestClient { @Override public ListBodySpec hasSize(int size) { + List actual = this.result.getResponseBody(); + String message = "Response body does not contain " + size + " elements"; + this.result.assertWithDiagnostics(() -> assertEquals(message, size, actual.size())); return this; }