Skip to content

Commit 8b2a7e8

Browse files
committed
Merge pull request #39544 from gdmrw
* pr/39544: Add smoke test for InfoContributor Closes gh-39544
2 parents 0f341f4 + 3befeb2 commit 8b2a7e8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/SampleActuatorApplicationTests.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,18 @@ void testLegacyHyphen() {
177177
assertThat(entity.getBody()).contains(entry("legacy", "legacy"));
178178
}
179179

180+
@Test
181+
@SuppressWarnings("unchecked")
182+
void testInfo() {
183+
ResponseEntity<Map<String, Object>> entity = asMapEntity(
184+
this.restTemplate.withBasicAuth("user", "password").getForEntity("/actuator/info", Map.class));
185+
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
186+
assertThat(entity.getBody()).containsKey("build");
187+
Map<String, Object> body = entity.getBody();
188+
Map<String, Object> example = (Map<String, Object>) body.get("example");
189+
assertThat(example).containsEntry("someKey", "someValue");
190+
}
191+
180192
@SuppressWarnings({ "unchecked", "rawtypes" })
181193
static <K, V> ResponseEntity<Map<K, V>> asMapEntity(ResponseEntity<Map> entity) {
182194
return (ResponseEntity) entity;

0 commit comments

Comments
 (0)