From 6e2ecb8a43e5a1a3cbf40fbc1ec7c7df2cabc991 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Sat, 17 Mar 2018 12:28:41 -0700 Subject: [PATCH] Fix broken endpoint integration tests Ensure that JSON response is returned when extracting data from the error details. See gh-12513 --- .../web/annotation/AbstractWebEndpointIntegrationTests.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/AbstractWebEndpointIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/AbstractWebEndpointIntegrationTests.java index a69aeaab0cb..afdc9f86cf9 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/AbstractWebEndpointIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/AbstractWebEndpointIntegrationTests.java @@ -168,7 +168,8 @@ public abstract class AbstractWebEndpointIntegrationTests { WebTestClient.BodyContentSpec body = client.get().uri("/query?two=two") - .exchange().expectStatus().isBadRequest().expectBody(); + .accept(MediaType.APPLICATION_JSON).exchange().expectStatus() + .isBadRequest().expectBody(); validateErrorBody(body, HttpStatus.BAD_REQUEST, "/endpoints/query", "Missing parameters: one"); }); @@ -290,7 +291,8 @@ public abstract class AbstractWebEndpointIntegrationTests { WebTestClient.BodyContentSpec body = client.get().uri("/requiredparameters") - .exchange().expectStatus().isBadRequest().expectBody(); + .accept(MediaType.APPLICATION_JSON).exchange().expectStatus() + .isBadRequest().expectBody(); validateErrorBody(body, HttpStatus.BAD_REQUEST, "/endpoints/requiredparameters", "Missing parameters: foo"); });