Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public static StepExecution createStepExecution(JobParameters jobParameters, Exe
public static StepExecution createStepExecution(JobParameters jobParameters) {
JobExecution jobExecution = createJobExecution(DEFAULT_JOB_NAME, DEFAULT_JOB_INSTANCE_ID,
DEFAULT_JOB_EXECUTION_ID, jobParameters);
StepExecution stepExecution = createStepExecution();
StepExecution stepExecution = createStepExecution(jobExecution, DEFAULT_STEP_NAME, DEFAULT_STEP_EXECUTION_ID);
jobExecution.addStepExecution(stepExecution);
return stepExecution;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@
*/
package org.springframework.batch.test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import java.util.List;

import org.junit.jupiter.api.Test;
import org.springframework.batch.core.job.parameters.JobParameters;
import org.springframework.batch.core.converter.DefaultJobParametersConverter;
import org.springframework.batch.core.job.parameters.JobParametersBuilder;
import org.springframework.batch.core.step.StepExecution;
import org.springframework.batch.infrastructure.support.PropertiesConverter;

/**
Expand Down Expand Up @@ -90,6 +93,14 @@ void testCreateStepExecutionJobExecutionStringLong() {
assertNotNull(MetaDataInstanceFactory.createStepExecution(stepName, stepExecutionId));
}

@Test
void testCreateStepExecutionJobParameters() {
JobParameters parameters = new JobParametersBuilder().addString("foo", "bar").toJobParameters();
StepExecution stepExecution = MetaDataInstanceFactory.createStepExecution(parameters);
String paramValue = stepExecution.getJobExecution().getJobParameters().getString("foo");
assertEquals("bar", paramValue);
}

@Test
void testCreateJobExecutionWithStepExecutions() {
assertNotNull(MetaDataInstanceFactory.createJobExecutionWithStepExecutions(executionId, List.of(stepName)));
Expand Down