From 3befeb2d7e64a049adfc8b92d88319ad41afb0f9 Mon Sep 17 00:00:00 2001 From: gdmrw Date: Wed, 14 Feb 2024 03:30:03 -0800 Subject: [PATCH] Add smoke test for InfoContributor See gh-39544 --- .../actuator/SampleActuatorApplicationTests.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/SampleActuatorApplicationTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/SampleActuatorApplicationTests.java index 8ddd0cefe6..360e0719a5 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/SampleActuatorApplicationTests.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/SampleActuatorApplicationTests.java @@ -177,6 +177,18 @@ class SampleActuatorApplicationTests { assertThat(entity.getBody()).contains(entry("legacy", "legacy")); } + @Test + @SuppressWarnings("unchecked") + void testInfo() { + ResponseEntity> entity = asMapEntity( + this.restTemplate.withBasicAuth("user", "password").getForEntity("/actuator/info", Map.class)); + assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(entity.getBody()).containsKey("build"); + Map body = entity.getBody(); + Map example = (Map) body.get("example"); + assertThat(example).containsEntry("someKey", "someValue"); + } + @SuppressWarnings({ "unchecked", "rawtypes" }) static ResponseEntity> asMapEntity(ResponseEntity entity) { return (ResponseEntity) entity;