mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Add smoke test for InfoContributor
See gh-39544
This commit is contained in:
parent
0f341f4cb0
commit
3befeb2d7e
@ -177,6 +177,18 @@ class SampleActuatorApplicationTests {
|
||||
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" })
|
||||
static <K, V> ResponseEntity<Map<K, V>> asMapEntity(ResponseEntity<Map> entity) {
|
||||
return (ResponseEntity) entity;
|
||||
|
Loading…
Reference in New Issue
Block a user