From 5b9beecb893df1b737ec3bcef30c5c0fe61d87b4 Mon Sep 17 00:00:00 2001 From: Mahmoud Ben Hassine Date: Mon, 17 Jul 2023 11:08:38 +0200 Subject: [PATCH] Document the type and name of the surrounding job in JobLauncherTestUtils#launchStep Resolves #3825 (cherry picked from commit 5e849c6c9531f4cc0197763be545b2594b709a6a) --- .../batch/test/JobLauncherTestUtils.java | 24 +++++++------ .../batch/test/StepRunner.java | 36 +++++++++++-------- 2 files changed, 36 insertions(+), 24 deletions(-) diff --git a/spring-batch-test/src/main/java/org/springframework/batch/test/JobLauncherTestUtils.java b/spring-batch-test/src/main/java/org/springframework/batch/test/JobLauncherTestUtils.java index dbeb4dab2..b1a4da0f2 100644 --- a/spring-batch-test/src/main/java/org/springframework/batch/test/JobLauncherTestUtils.java +++ b/spring-batch-test/src/main/java/org/springframework/batch/test/JobLauncherTestUtils.java @@ -177,9 +177,10 @@ public class JobLauncherTestUtils { } /** - * Launch just the specified step in the job. A unique set of JobParameters will - * automatically be generated. An IllegalStateException is thrown if there is no Step - * with the given name. + * Launch just the specified step in a surrounding single-step job of type + * {@link SimpleJob} named {@link StepRunner#JOB_NAME}. A unique set of JobParameters + * will automatically be generated. An IllegalStateException is thrown if there is no + * Step with the given name. * @param stepName The name of the step to launch * @return JobExecution */ @@ -188,9 +189,10 @@ public class JobLauncherTestUtils { } /** - * Launch just the specified step in the job. A unique set of JobParameters will - * automatically be generated. An IllegalStateException is thrown if there is no Step - * with the given name. + * Launch just the specified step in a surrounding single-step job of type + * {@link SimpleJob} named {@link StepRunner#JOB_NAME}. A unique set of JobParameters + * will automatically be generated. An IllegalStateException is thrown if there is no + * Step with the given name. * @param stepName The name of the step to launch * @param jobExecutionContext An ExecutionContext whose values will be loaded into the * Job ExecutionContext prior to launching the step. @@ -201,8 +203,9 @@ public class JobLauncherTestUtils { } /** - * Launch just the specified step in the job. An IllegalStateException is thrown if - * there is no Step with the given name. + * Launch just the specified step in a surrounding single-step job of type + * {@link SimpleJob} named {@link StepRunner#JOB_NAME}. An IllegalStateException is + * thrown if there is no Step with the given name. * @param stepName The name of the step to launch * @param jobParameters The JobParameters to use during the launch * @return JobExecution @@ -212,8 +215,9 @@ public class JobLauncherTestUtils { } /** - * Launch just the specified step in the job. An IllegalStateException is thrown if - * there is no Step with the given name. + * Launch just the specified step in a surrounding single-step job of type + * {@link SimpleJob} named {@link StepRunner#JOB_NAME}. An IllegalStateException is + * thrown if there is no Step with the given name. * @param stepName The name of the step to launch * @param jobParameters The JobParameters to use during the launch * @param jobExecutionContext An ExecutionContext whose values will be loaded into the diff --git a/spring-batch-test/src/main/java/org/springframework/batch/test/StepRunner.java b/spring-batch-test/src/main/java/org/springframework/batch/test/StepRunner.java index d60a129f3..2f1bc8680 100755 --- a/spring-batch-test/src/main/java/org/springframework/batch/test/StepRunner.java +++ b/spring-batch-test/src/main/java/org/springframework/batch/test/StepRunner.java @@ -42,9 +42,8 @@ import org.springframework.batch.item.ExecutionContext; import org.springframework.lang.Nullable; /** - * Utility class for executing steps outside of a {@link Job}. This is useful in end to - * end testing in order to allow for the testing of a step individually without running - * every Step in a job. + * Utility class for executing steps. This is useful in end to end testing in order to + * allow for the testing of a step individually without running every Step in a job. * *