diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/runtime/JobParametersFactory.java b/spring-batch-core/src/main/java/org/springframework/batch/core/runtime/JobParametersFactory.java index 9db981ad9..be83e8d26 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/runtime/JobParametersFactory.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/runtime/JobParametersFactory.java @@ -19,6 +19,7 @@ package org.springframework.batch.core.runtime; import java.util.Properties; import org.springframework.batch.core.domain.JobParameters; +import org.springframework.batch.core.domain.JobParametersBuilder; /** * A factory for {@link JobParameters} instances. A job can be @@ -29,9 +30,10 @@ import org.springframework.batch.core.domain.JobParameters; * {@link JobParameters} and some do not (e.g. for an ad-hoc execution a simple * label might be enough). * - * * @author Dave Syer * + * @see JobParametersBuilder + * */ public interface JobParametersFactory { diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/bootstrap/support/JobParametersPropertyEditorTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/bootstrap/support/JobParametersPropertyEditorTests.java index 1caad23ee..b6d0db828 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/bootstrap/support/JobParametersPropertyEditorTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/bootstrap/support/JobParametersPropertyEditorTests.java @@ -15,9 +15,12 @@ */ package org.springframework.batch.execution.bootstrap.support; +import java.util.Properties; + import junit.framework.TestCase; import org.springframework.batch.core.domain.JobParameters; +import org.springframework.batch.support.PropertiesConverter; /** * @author Dave Syer @@ -43,7 +46,9 @@ public class JobParametersPropertyEditorTests extends TestCase { */ public void testGetAsText() { editor.setAsText("foo=bar,spam=bucket"); - assertEquals("foo=bar,spam=bucket", editor.getAsText()); + Properties properties = PropertiesConverter.stringToProperties(editor.getAsText()); + assertEquals("bar", properties.getProperty("foo")); + assertEquals("bucket", properties.getProperty("spam")); } } diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/resource/DefaultJobInstanceLabelGeneratorTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/resource/DefaultJobInstanceLabelGeneratorTests.java index 169a0307e..5504e946e 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/resource/DefaultJobInstanceLabelGeneratorTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/resource/DefaultJobInstanceLabelGeneratorTests.java @@ -35,7 +35,7 @@ public class DefaultJobInstanceLabelGeneratorTests extends TestCase { * Test method for {@link org.springframework.batch.execution.resource.DefaultJobInstanceLabelGenerator#getLabel()}. */ public void testDefaultGetLabel() throws Exception { - JobParameters jobParameters = new JobParametersBuilder().addDate("schedule.date", new Date(0)).addString("key", "bar").toJobParameters(); + JobParameters jobParameters = new JobParametersBuilder().addDate("schedule.date", new Date(1)).addString("key", "bar").toJobParameters(); JobInstance job = new JobInstance(null, jobParameters, new Job(null)); assertEquals("null-bar-19700101", instance.getLabel(job)); } @@ -44,7 +44,7 @@ public class DefaultJobInstanceLabelGeneratorTests extends TestCase { * Test method for {@link org.springframework.batch.execution.resource.DefaultJobInstanceLabelGenerator#getLabel()}. */ public void testGetLabelWithAllProperties() throws Exception { - JobParameters jobParameters = new JobParametersBuilder().addDate("schedule.date", new Date(0)).addString("key", "bar").toJobParameters(); + JobParameters jobParameters = new JobParametersBuilder().addDate("schedule.date", new Date(1)).addString("key", "bar").toJobParameters(); JobInstance job = new JobInstance(null, jobParameters, new Job("foo")); assertEquals("foo-bar-19700101", instance.getLabel(job)); }