1
1
package org .springframework .batch .core .test .step ;
2
2
3
+ import java .util .ArrayList ;
4
+ import java .util .Arrays ;
5
+ import java .util .List ;
6
+
3
7
import org .junit .Before ;
4
8
import org .junit .Test ;
5
9
import org .junit .runner .RunWith ;
10
+
6
11
import org .springframework .batch .core .BatchStatus ;
7
12
import org .springframework .batch .core .ExitStatus ;
8
13
import org .springframework .batch .core .JobExecution ;
23
28
import org .springframework .test .context .junit4 .SpringJUnit4ClassRunner ;
24
29
import org .springframework .transaction .PlatformTransactionManager ;
25
30
26
- import java .util .ArrayList ;
27
- import java .util .Arrays ;
28
- import java .util .List ;
29
-
30
31
import static org .junit .Assert .assertEquals ;
31
32
32
33
/**
@@ -158,8 +159,9 @@ public void testFilterCountOnRetryWithNonTransactionalProcessorWhenSkipInWrite()
158
159
public void testExceptionInProcessDuringChunkScan () throws Exception {
159
160
// Given
160
161
ListItemReader <Integer > itemReader = new ListItemReader <>(Arrays .asList (1 , 2 , 3 , 4 , 5 , 6 , 7 ));
162
+
161
163
ItemProcessor <Integer , Integer > itemProcessor = new ItemProcessor <Integer , Integer >() {
162
- int cpt ;
164
+ private int cpt ;
163
165
164
166
@ Override
165
167
public Integer process (Integer item ) throws Exception {
@@ -170,8 +172,9 @@ public Integer process(Integer item) throws Exception {
170
172
return item ;
171
173
}
172
174
};
175
+
173
176
ItemWriter <Integer > itemWriter = new ItemWriter <Integer >() {
174
- int cpt ;
177
+ private int cpt ;
175
178
176
179
@ Override
177
180
public void write (List <? extends Integer > items ) throws Exception {
@@ -181,6 +184,7 @@ public void write(List<? extends Integer> items) throws Exception {
181
184
}
182
185
}
183
186
};
187
+
184
188
Step step = new StepBuilderFactory (jobRepository , transactionManager ).get ("step" )
185
189
.<Integer , Integer >chunk (5 )
186
190
.reader (itemReader )
0 commit comments