Let's demonstrate writing a test case for Spring Batch applications:
<dependency> <groupId>org.springframework.batch</groupId> <artifactId>spring-batch-test</artifactId> <version>2.2.0.RELEASE</version> </dependency> <!-- Junit --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency>
Let's create a simple Test
class called mport static org.junit.Assert.assertEquals
:
import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.batch.core.BatchStatus; import org.springframework.batch.core.JobExecution; import org.springframework.batch.test.JobLauncherTestUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner...