diff --git a/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/listener/TaskLifecycleListener.java b/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/listener/TaskLifecycleListener.java index 0f982124..271b8a81 100644 --- a/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/listener/TaskLifecycleListener.java +++ b/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/listener/TaskLifecycleListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2019 the original author or authors. + * Copyright 2016-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -276,14 +276,13 @@ public class TaskLifecycleListener implements ApplicationListener taskExecutions = this.taskExplorer.findAll(PageRequest.of(0, 10)); + assertThat(taskExecutions.getTotalElements()).as("Only one row is expected").isEqualTo(1); + assertThat(taskExecutions.iterator().next().getExitCode().intValue()).as("return code should be 0") + .isEqualTo(0); + assertThat(this.taskExplorer.getTaskExecution(1).getStartTime().getTime()).isEqualTo(startDate.getTime()); + + } + @Test public void testWithNoTaskExecution() throws Exception { assertThatExceptionOfType(ApplicationContextException.class).isThrownBy(() -> {