mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Merge pull request #39544 from gdmrw
* pr/39544: Add smoke test for InfoContributor Closes gh-39544
This commit is contained in:
commit
8b2a7e8a19
@ -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