Update Batch tests

Related to: https://github.com/spring-projects/spring-batch/issues/4245

Closes gh-37348
This commit is contained in:
Mahmoud Ben Hassine 2023-09-12 11:49:50 +02:00 committed by Brian Clozel
parent 9e37c6842a
commit 626d858d81
1 changed files with 12 additions and 9 deletions

View File

@ -39,7 +39,6 @@ import org.springframework.batch.core.configuration.JobFactory;
import org.springframework.batch.core.configuration.JobRegistry;
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
import org.springframework.batch.core.configuration.support.DefaultBatchConfiguration;
import org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor;
import org.springframework.batch.core.explore.JobExplorer;
import org.springframework.batch.core.job.AbstractJob;
import org.springframework.batch.core.launch.JobLauncher;
@ -96,6 +95,7 @@ import static org.mockito.Mockito.mock;
* @author Stephane Nicoll
* @author Vedran Pavic
* @author Kazuki Shimizu
* @author Mahmoud Ben Hassine
*/
@ExtendWith(OutputCaptureExtension.class)
class BatchAutoConfigurationTests {
@ -515,13 +515,6 @@ class BatchAutoConfigurationTests {
@Autowired
private JobRepository jobRepository;
@Bean
static JobRegistryBeanPostProcessor registryProcessor(JobRegistry jobRegistry) {
JobRegistryBeanPostProcessor processor = new JobRegistryBeanPostProcessor();
processor.setJobRegistry(jobRegistry);
return processor;
}
@Bean
Job discreteJob() {
AbstractJob job = new AbstractJob("discreteRegisteredJob") {
@ -685,7 +678,17 @@ class BatchAutoConfigurationTests {
@Bean
Job job2() {
return mock(Job.class);
return new Job() {
@Override
public String getName() {
return "discreteLocalJob2";
}
@Override
public void execute(JobExecution execution) {
execution.setStatus(BatchStatus.COMPLETED);
}
};
}
}