From 60852ce476c4dabd477220e2a05ac658fe2af995 Mon Sep 17 00:00:00 2001 From: Ryan Baxter Date: Tue, 26 Apr 2022 20:54:44 -0400 Subject: [PATCH] Fixing tests --- .../cloud/config/client/ConfigServerConfigDataLoaderTests.java | 1 + .../config/client/ConfigServicePropertySourceLocatorTests.java | 1 + .../server/environment/VaultKvAccessStrategySupport.java | 3 +-- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/spring-cloud-config-client/src/test/java/org/springframework/cloud/config/client/ConfigServerConfigDataLoaderTests.java b/spring-cloud-config-client/src/test/java/org/springframework/cloud/config/client/ConfigServerConfigDataLoaderTests.java index 9b140b5e..22a2f8b4 100644 --- a/spring-cloud-config-client/src/test/java/org/springframework/cloud/config/client/ConfigServerConfigDataLoaderTests.java +++ b/spring-cloud-config-client/src/test/java/org/springframework/cloud/config/client/ConfigServerConfigDataLoaderTests.java @@ -504,6 +504,7 @@ public class ConfigServerConfigDataLoaderTests { headers.setContentType(MediaType.APPLICATION_JSON); when(response.getHeaders()).thenReturn(headers); when(response.getStatusCode()).thenReturn(status); + when(response.getRawStatusCode()).thenReturn(status.value()); when(response.getBody()).thenReturn(new ByteArrayInputStream("{}".getBytes())); } diff --git a/spring-cloud-config-client/src/test/java/org/springframework/cloud/config/client/ConfigServicePropertySourceLocatorTests.java b/spring-cloud-config-client/src/test/java/org/springframework/cloud/config/client/ConfigServicePropertySourceLocatorTests.java index 3fb1838b..2423baa7 100644 --- a/spring-cloud-config-client/src/test/java/org/springframework/cloud/config/client/ConfigServicePropertySourceLocatorTests.java +++ b/spring-cloud-config-client/src/test/java/org/springframework/cloud/config/client/ConfigServicePropertySourceLocatorTests.java @@ -559,6 +559,7 @@ public class ConfigServicePropertySourceLocatorTests { headers.setContentType(MediaType.APPLICATION_JSON); Mockito.when(response.getHeaders()).thenReturn(headers); Mockito.when(response.getStatusCode()).thenReturn(status); + Mockito.when(response.getRawStatusCode()).thenReturn(status.value()); Mockito.when(response.getBody()).thenReturn(new ByteArrayInputStream("{}".getBytes())); } diff --git a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/VaultKvAccessStrategySupport.java b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/VaultKvAccessStrategySupport.java index 4356b2da..4e7b6f34 100644 --- a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/VaultKvAccessStrategySupport.java +++ b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/VaultKvAccessStrategySupport.java @@ -20,7 +20,6 @@ import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; -import org.springframework.http.HttpStatusCode; import org.springframework.http.ResponseEntity; import org.springframework.web.client.HttpStatusCodeException; import org.springframework.web.client.RestOperations; @@ -71,7 +70,7 @@ abstract class VaultKvAccessStrategySupport implements VaultKvAccessStrategy { ResponseEntity response = this.rest.exchange(urlTemplate, HttpMethod.GET, new HttpEntity<>(headers), VaultResponse.class, key); - HttpStatusCode status = response.getStatusCode(); + HttpStatus status = response.getStatusCode(); if (status == HttpStatus.OK) { return extractDataFromBody(response.getBody()); }