Skip to content

Commit d721ab7

Browse files
committed
Update tests to new format of exception messages
1 parent e4c52d1 commit d721ab7

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

spring-cloud-task-batch/src/test/java/org/springframework/cloud/task/batch/handler/TaskJobLauncherApplicationRunnerTests.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
import org.springframework.cloud.task.configuration.EnableTask;
5252
import org.springframework.cloud.task.configuration.SimpleTaskAutoConfiguration;
5353
import org.springframework.cloud.task.configuration.SingleTaskConfiguration;
54+
import org.springframework.cloud.task.listener.TaskException;
5455
import org.springframework.cloud.task.repository.TaskExecution;
5556
import org.springframework.cloud.task.repository.TaskExplorer;
5657
import org.springframework.context.ApplicationListener;
@@ -71,8 +72,7 @@
7172
*/
7273
public class TaskJobLauncherApplicationRunnerTests {
7374

74-
private static final String DEFAULT_ERROR_MESSAGE = "The following Jobs have failed: \n"
75-
+ "Job jobA failed during execution for job instance id 1 with jobExecutionId of 1 \n";
75+
private static final String DEFAULT_ERROR_MESSAGE = "Job jobA failed during execution for job instance id 1 with jobExecutionId of 1";
7676

7777
private ConfigurableApplicationContext applicationContext;
7878

@@ -171,9 +171,8 @@ private void validateForFail(String errorMessage, Class<?> clazz, String[] enabl
171171
Executable executable = () -> this.applicationContext = SpringApplication
172172
.run(new Class[] { clazz, PropertyPlaceholderAutoConfiguration.class }, enabledArgs);
173173

174-
assertThatExceptionOfType(IllegalStateException.class).isThrownBy(executable::execute)
175-
.havingCause()
176-
.withMessage(errorMessage);
174+
assertThatExceptionOfType(TaskException.class).isThrownBy(executable::execute)
175+
.withMessageContaining(errorMessage);
177176
}
178177

179178
@Component

spring-cloud-task-core/src/test/java/org/springframework/cloud/task/TaskCoreTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ public class TaskCoreTests {
5757
private static final String EXCEPTION_INVALID_TASK_EXECUTION_ID = "java.lang.IllegalArgumentException: "
5858
+ "Invalid TaskExecution, ID 55 not found";
5959

60-
private static final String ERROR_MESSAGE = "errorMessage='java.lang.IllegalStateException: "
61-
+ "Failed to execute CommandLineRunner";
60+
private static final String ERROR_MESSAGE = "errorMessage='java.lang.IllegalStateException: " + "FOO EXCEPTION";
6261

6362
private ConfigurableApplicationContext applicationContext;
6463

0 commit comments

Comments
 (0)