Skip to content

Commit 6346d4f

Browse files
committed
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
1 parent 627c691 commit 6346d4f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/ScheduledTasksEndpointDocumentationTests.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ void scheduledTasks() {
7777
fieldWithPath("custom.[].trigger").description("Trigger for the task."))
7878
.andWithPrefix("*.[].",
7979
fieldWithPath("lastExecution").description("Last execution of this task, if any.")
80-
.optional())
80+
.optional()
81+
.type(JsonFieldType.OBJECT))
8182
.andWithPrefix("*.[].lastExecution.", lastExecution())));
8283
}
8384

@@ -98,7 +99,8 @@ private FieldDescriptor nextExecutionWithPrefix(String prefix) {
9899

99100
private FieldDescriptor[] lastExecution() {
100101
return new FieldDescriptor[] {
101-
fieldWithPath("status").description("Status of the last execution (STARTED, SUCCESS, ERROR)."),
102+
fieldWithPath("status").description("Status of the last execution (STARTED, SUCCESS, ERROR).")
103+
.type(JsonFieldType.STRING),
102104
fieldWithPath("time").description("Time of the last execution.").type(JsonFieldType.STRING),
103105
fieldWithPath("exception.type").description("Exception type thrown by the task, if any.")
104106
.type(JsonFieldType.STRING)

0 commit comments

Comments
 (0)