diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/JobRegistryBackgroundJobRunnerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/JobRegistryBackgroundJobRunnerTests.java index 66eb4ba52..f2d817698 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/JobRegistryBackgroundJobRunnerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/JobRegistryBackgroundJobRunnerTests.java @@ -33,7 +33,18 @@ public class JobRegistryBackgroundJobRunnerTests { * {@link org.springframework.batch.core.launch.support.JobRegistryBackgroundJobRunner#main(java.lang.String[])}. */ @Test - public void testMain() { + public void testMain() throws Exception { + JobRegistryBackgroundJobRunner.main( + ClassUtils.addResourcePathToPackagePath(getClass(), "test-environment-with-registry.xml"), ClassUtils + .addResourcePathToPackagePath(getClass(), "job.xml")); + assertEquals(0, JobRegistryBackgroundJobRunner.getErrors().size()); + } + + @Test + public void testMainWithAutoRegister() throws Exception { + JobRegistryBackgroundJobRunner.main( + ClassUtils.addResourcePathToPackagePath(getClass(), "test-environment-with-registry-and-auto-register.xml"), ClassUtils + .addResourcePathToPackagePath(getClass(), "job.xml")); assertEquals(0, JobRegistryBackgroundJobRunner.getErrors().size()); } @@ -41,9 +52,6 @@ public class JobRegistryBackgroundJobRunnerTests { public void setUp() throws Exception { JobRegistryBackgroundJobRunner.getErrors().clear(); System.setProperty(JobRegistryBackgroundJobRunner.EMBEDDED, ""); - JobRegistryBackgroundJobRunner.main( - ClassUtils.addResourcePathToPackagePath(getClass(), "test-environment-with-registry.xml"), ClassUtils - .addResourcePathToPackagePath(getClass(), "job.xml")); } @After diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/launch/support/test-environment-with-registry-and-auto-register.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/launch/support/test-environment-with-registry-and-auto-register.xml new file mode 100644 index 000000000..683d4809b --- /dev/null +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/launch/support/test-environment-with-registry-and-auto-register.xml @@ -0,0 +1,16 @@ + + + + + + + + + + diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/launch/support/test-environment-with-registry.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/launch/support/test-environment-with-registry.xml index b26bab52a..3243eb0ec 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/launch/support/test-environment-with-registry.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/launch/support/test-environment-with-registry.xml @@ -9,6 +9,6 @@ - +