|
1 | 1 | /*
|
2 | | - * Copyright 2006-2023 the original author or authors. |
| 2 | + * Copyright 2006-2025 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
33 | 33 |
|
34 | 34 | import org.junit.jupiter.api.BeforeEach;
|
35 | 35 | import org.junit.jupiter.api.Test;
|
| 36 | +import org.junit.jupiter.params.ParameterizedTest; |
| 37 | +import org.junit.jupiter.params.provider.EnumSource; |
36 | 38 | import org.springframework.batch.core.BatchStatus;
|
37 | 39 | import org.springframework.batch.core.job.JobExecution;
|
38 | 40 | import org.springframework.batch.core.job.JobInstance;
|
|
61 | 63 | * @author Baris Cubukcuoglu
|
62 | 64 | * @author Mahmoud Ben Hassine
|
63 | 65 | * @author Parikshit Dutta
|
| 66 | + * @author Seungyong Hong |
64 | 67 | *
|
65 | 68 | */
|
66 | 69 | class SimpleJobRepositoryTests {
|
@@ -103,7 +106,7 @@ void setUp() {
|
103 | 106 |
|
104 | 107 | jobRepository = new SimpleJobRepository(jobInstanceDao, jobExecutionDao, stepExecutionDao, ecDao);
|
105 | 108 |
|
106 | | - jobParameters = new JobParametersBuilder().addString("bar", "test").toJobParameters(); |
| 109 | + jobParameters = new JobParametersBuilder().addString("bar", "test", false).toJobParameters(); |
107 | 110 |
|
108 | 111 | job = new JobSupport();
|
109 | 112 | job.setBeanName("RepositoryTest");
|
@@ -289,9 +292,10 @@ void testCreateJobExecutionStatusUnknown() {
|
289 | 292 | assertThrows(JobRestartException.class, () -> jobRepository.createJobExecution("foo", new JobParameters()));
|
290 | 293 | }
|
291 | 294 |
|
292 | | - @Test |
293 | | - void testCreateJobExecutionAlreadyComplete() { |
294 | | - jobExecution.setStatus(BatchStatus.COMPLETED); |
| 295 | + @ParameterizedTest |
| 296 | + @EnumSource(mode = EnumSource.Mode.INCLUDE, names = {"COMPLETED", "ABANDONED"}) |
| 297 | + void testCreateJobExecutionAlreadyComplete(BatchStatus batchStatus) { |
| 298 | + jobExecution.setStatus(batchStatus); |
295 | 299 | jobExecution.setEndTime(LocalDateTime.now());
|
296 | 300 |
|
297 | 301 | when(jobInstanceDao.getJobInstance("foo", new JobParameters())).thenReturn(jobInstance);
|
|
0 commit comments