diff --git a/archetypes/simple-cli/pom.xml b/archetypes/simple-cli/pom.xml index 7ebc4c99f..14bcd821d 100644 --- a/archetypes/simple-cli/pom.xml +++ b/archetypes/simple-cli/pom.xml @@ -36,7 +36,7 @@ junit junit - 3.8.1 + 4.4 test diff --git a/archetypes/simple-cli/src/main/resources/launch-context.xml b/archetypes/simple-cli/src/main/resources/launch-context.xml new file mode 100644 index 000000000..6df744a45 --- /dev/null +++ b/archetypes/simple-cli/src/main/resources/launch-context.xml @@ -0,0 +1,9 @@ + + + + + + + diff --git a/archetypes/simple-cli/src/test/java/example/ExampleJobConfigurationTests.java b/archetypes/simple-cli/src/test/java/example/ExampleJobConfigurationTests.java index 99aff5cb2..63386985f 100644 --- a/archetypes/simple-cli/src/test/java/example/ExampleJobConfigurationTests.java +++ b/archetypes/simple-cli/src/test/java/example/ExampleJobConfigurationTests.java @@ -15,32 +15,27 @@ */ package example; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.junit.runner.RunWith; import org.springframework.batch.core.launch.JobLauncher; -import org.springframework.test.AbstractDependencyInjectionSpringContextTests; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; /** * @author Dave Syer * */ -public class ExampleJobConfigurationTests extends AbstractDependencyInjectionSpringContextTests { +@ContextConfiguration(locations={"/launch-context.xml"}) +@RunWith(SpringJUnit4ClassRunner.class) +public class ExampleJobConfigurationTests { + @Autowired private JobLauncher jobLauncher; - /** - * Public setter for the {@link JobLauncher}. - * @param jobLauncher the {@link JobLauncher} to set - */ - public void setJobLauncher(JobLauncher jobLauncher) { - this.jobLauncher = jobLauncher; - } - - /* (non-Javadoc) - * @see org.springframework.test.AbstractSingleSpringContextTests#getConfigLocations() - */ - protected String[] getConfigLocations() { - return new String[] {"/META-INF/spring/module-context.xml"}; - } - + @Test public void testSimpleProperties() throws Exception { assertNotNull(jobLauncher); }