mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Merge branch '3.2.x'
Closes gh-39595
This commit is contained in:
commit
b449acf4ca
@ -177,6 +177,18 @@ class SampleActuatorApplicationTests {
|
|||||||
assertThat(entity.getBody()).contains(entry("legacy", "legacy"));
|
assertThat(entity.getBody()).contains(entry("legacy", "legacy"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
void testInfo() {
|
||||||
|
ResponseEntity<Map<String, Object>> entity = asMapEntity(
|
||||||
|
this.restTemplate.withBasicAuth("user", "password").getForEntity("/actuator/info", Map.class));
|
||||||
|
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||||
|
assertThat(entity.getBody()).containsKey("build");
|
||||||
|
Map<String, Object> body = entity.getBody();
|
||||||
|
Map<String, Object> example = (Map<String, Object>) body.get("example");
|
||||||
|
assertThat(example).containsEntry("someKey", "someValue");
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
static <K, V> ResponseEntity<Map<K, V>> asMapEntity(ResponseEntity<Map> entity) {
|
static <K, V> ResponseEntity<Map<K, V>> asMapEntity(ResponseEntity<Map> entity) {
|
||||||
return (ResponseEntity) entity;
|
return (ResponseEntity) entity;
|
||||||
|
Loading…
Reference in New Issue
Block a user