From e53453c69c5dce3e50bbdd256d2aeb5dd76b5b67 Mon Sep 17 00:00:00 2001 From: izeye Date: Tue, 20 Apr 2021 10:13:48 +0900 Subject: [PATCH] Fix broken assertions in tests This commit also restores the HTTP response body assertion that has been dropped in 5873ddd. See gh-26162 --- .../reactive/server/AbstractReactiveWebServerFactoryTests.java | 2 +- .../servlet/server/AbstractServletWebServerFactoryTests.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java index 3fc672d34ec..5f95b61c2b7 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java @@ -469,7 +469,7 @@ public abstract class AbstractReactiveWebServerFactoryTests { try { ContentResponse response = client.POST("http://localhost:" + this.webServer.getPort()) .content(new StringContentProvider("Hello World"), "text/plain").send(); - assertThat(response.getStatus() == HttpStatus.OK.value()); + assertThat(response.getStatus()).isEqualTo(HttpStatus.OK.value()); assertThat(response.getContentAsString()).isEqualTo("Hello World"); } finally { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java index 07ddcc80982..397658fd40e 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java @@ -1139,7 +1139,8 @@ public abstract class AbstractServletWebServerFactoryTests { client.start(); try { ContentResponse response = client.GET("http://localhost:" + this.webServer.getPort() + "/hello"); - assertThat(response.getStatus() == HttpStatus.OK.value()); + assertThat(response.getStatus()).isEqualTo(HttpStatus.OK.value()); + assertThat(response.getContentAsString()).isEqualTo("Hello World"); } finally { client.stop();