Fixing tests

This commit is contained in:
Ryan Baxter
2022-04-26 20:54:44 -04:00
parent dbb3dcaafb
commit 60852ce476
3 changed files with 3 additions and 2 deletions

View File

@@ -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()));
}

View File

@@ -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()));
}

View File

@@ -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<VaultResponse> 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());
}