From 6346d4fd6b0702ee84198899e21068f0cbfd6f02 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 19 Sep 2024 12:03:04 +0100 Subject: [PATCH] Accommodate absence of last execution A task's last execution is absent if it has not yet been executed. This commit updates the documentation test to accommodate this possibility. See gh-42351 --- .../ScheduledTasksEndpointDocumentationTests.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/ScheduledTasksEndpointDocumentationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/ScheduledTasksEndpointDocumentationTests.java index 5e8e7c833d..e63717bccd 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/ScheduledTasksEndpointDocumentationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/ScheduledTasksEndpointDocumentationTests.java @@ -77,7 +77,8 @@ class ScheduledTasksEndpointDocumentationTests extends MockMvcEndpointDocumentat fieldWithPath("custom.[].trigger").description("Trigger for the task.")) .andWithPrefix("*.[].", fieldWithPath("lastExecution").description("Last execution of this task, if any.") - .optional()) + .optional() + .type(JsonFieldType.OBJECT)) .andWithPrefix("*.[].lastExecution.", lastExecution()))); } @@ -98,7 +99,8 @@ class ScheduledTasksEndpointDocumentationTests extends MockMvcEndpointDocumentat private FieldDescriptor[] lastExecution() { return new FieldDescriptor[] { - fieldWithPath("status").description("Status of the last execution (STARTED, SUCCESS, ERROR)."), + fieldWithPath("status").description("Status of the last execution (STARTED, SUCCESS, ERROR).") + .type(JsonFieldType.STRING), fieldWithPath("time").description("Time of the last execution.").type(JsonFieldType.STRING), fieldWithPath("exception.type").description("Exception type thrown by the task, if any.") .type(JsonFieldType.STRING)