1515 */
1616package org .springframework .batch .test ;
1717
18+ import static org .junit .jupiter .api .Assertions .assertEquals ;
1819import static org .junit .jupiter .api .Assertions .assertNotNull ;
1920
2021import java .util .List ;
2122
2223import org .junit .jupiter .api .Test ;
2324import org .springframework .batch .core .job .parameters .JobParameters ;
2425import org .springframework .batch .core .converter .DefaultJobParametersConverter ;
26+ import org .springframework .batch .core .job .parameters .JobParametersBuilder ;
27+ import org .springframework .batch .core .step .StepExecution ;
2528import org .springframework .batch .infrastructure .support .PropertiesConverter ;
2629
2730/**
@@ -37,7 +40,7 @@ class MetaDataInstanceFactoryTests {
3740 private final String jobParametersString = "foo=bar" ;
3841
3942 private final JobParameters jobParameters = new DefaultJobParametersConverter ()
40- .getJobParameters (PropertiesConverter .stringToProperties (jobParametersString ));
43+ .getJobParameters (PropertiesConverter .stringToProperties (jobParametersString ));
4144
4245 private final Long executionId = 4321L ;
4346
@@ -90,6 +93,14 @@ void testCreateStepExecutionJobExecutionStringLong() {
9093 assertNotNull (MetaDataInstanceFactory .createStepExecution (stepName , stepExecutionId ));
9194 }
9295
96+ @ Test
97+ void testCreateStepExecutionJobParameters () {
98+ JobParameters parameters = new JobParametersBuilder ().addString ("foo" , "bar" ).toJobParameters ();
99+ StepExecution stepExecution = MetaDataInstanceFactory .createStepExecution (parameters );
100+ String paramValue = stepExecution .getJobExecution ().getJobParameters ().getString ("foo" );
101+ assertEquals ("bar" , paramValue );
102+ }
103+
93104 @ Test
94105 void testCreateJobExecutionWithStepExecutions () {
95106 assertNotNull (MetaDataInstanceFactory .createJobExecutionWithStepExecutions (executionId , List .of (stepName )));
0 commit comments