Browse Source

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
pull/42379/head
Andy Wilkinson 1 year ago
parent
commit
6346d4fd6b
  1. 6
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/ScheduledTasksEndpointDocumentationTests.java

6
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 @@ -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 @@ -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)

Loading…
Cancel
Save