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
/**
@@ -147,8 +148,9 @@ public void testFilterCountOnRetryWithNonTransactionalProcessorWhenSkipInWrite()
147
148
public void testExceptionInProcessDuringChunkScan () throws Exception {
148
149
// Given
149
150
ListItemReader <Integer > itemReader = new ListItemReader <>(Arrays .asList (1 , 2 , 3 , 4 , 5 , 6 , 7 ));
151
+
150
152
ItemProcessor <Integer , Integer > itemProcessor = new ItemProcessor <Integer , Integer >() {
151
- int cpt ;
153
+ private int cpt ;
152
154
153
155
@ Override
154
156
public Integer process (Integer item ) throws Exception {
@@ -159,8 +161,9 @@ public Integer process(Integer item) throws Exception {
159
161
return item ;
160
162
}
161
163
};
164
+
162
165
ItemWriter <Integer > itemWriter = new ItemWriter <Integer >() {
163
- int cpt ;
166
+ private int cpt ;
164
167
165
168
@ Override
166
169
public void write (List <? extends Integer > items ) throws Exception {
@@ -170,6 +173,7 @@ public void write(List<? extends Integer> items) throws Exception {
170
173
}
171
174
}
172
175
};
176
+
173
177
Step step = new StepBuilderFactory (jobRepository , transactionManager ).get ("step" )
174
178
.<Integer , Integer >chunk (5 )
175
179
.reader (itemReader )
0 commit comments