List of usage examples for org.springframework.batch.test ExecutionContextTestUtils getValueFromStep
@SuppressWarnings("unchecked") @Nullable public static <T> T getValueFromStep(StepExecution stepExecution, String key)
From source file:com.javaetmoi.core.batch.test.TestParallelAndPartitioning.java
@Test public void launchJob() throws Exception { // Launch the parallelAndPartitioningJob JobExecution execution = testUtils.launchJob(); // Batch Status assertEquals(ExitStatus.COMPLETED, execution.getExitStatus()); // Movies/*from www . j a v a2 s . com*/ assertEquals("8 movies", 8, getStepExecution(execution, "stepLogMovie").getWriteCount()); // Music Albums StepExecution stepExecutionMusic = getStepExecution(execution, "stepLogMusicAlbum"); assertEquals("11 music albums", 11, stepExecutionMusic.getWriteCount()); Object gridSize = ExecutionContextTestUtils.getValueFromStep(stepExecutionMusic, "SimpleStepExecutionSplitter.GRID_SIZE"); assertEquals("stepLogMusicAlbum divided into 2 partitions", 2L, gridSize); StepExecution stepExecPart0 = getStepExecution(execution, "stepLogMusicAlbumPartition:partition0"); assertEquals("First partition processed 6 music albums", 6, stepExecPart0.getWriteCount()); StepExecution stepExecPart1 = getStepExecution(execution, "stepLogMusicAlbumPartition:partition1"); assertEquals("Second partition processed 5 music albums", 5, stepExecPart1.getWriteCount()); }