@Test public void read() throws Exception { List<Long> rJudgmentIds = Lists.newArrayList(12l, 123l, 45l); Whitebox.setInternalState(scjImportProcessReader, "rJudgmentIds", new LinkedList<Long>(rJudgmentIds)); RawSourceScJudgment rJudgment0 = createSimpleRawSourceScJudgment(rJudgmentIds.get(0)); RawSourceScJudgment rJudgment1 = createSimpleRawSourceScJudgment(rJudgmentIds.get(1)); RawSourceScJudgment rJudgment2 = createSimpleRawSourceScJudgment(rJudgmentIds.get(2)); when(rawJudgmentRepository.findOne(rJudgmentIds.get(0), RawSourceScJudgment.class)).thenReturn(rJudgment0); when(rawJudgmentRepository.findOne(rJudgmentIds.get(1), RawSourceScJudgment.class)).thenReturn(rJudgment1); when(rawJudgmentRepository.findOne(rJudgmentIds.get(2), RawSourceScJudgment.class)).thenReturn(rJudgment2); readAndAssert(rJudgment0); readAndAssert(rJudgment1); readAndAssert(rJudgment2); readAndAssert(null); }
@Override public T read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException { Long rJudgmentId = rJudgmentIds.poll(); if (rJudgmentId == null) { return null; } return rawSourceJudgmentRepository.findOne(rJudgmentId, judgmentClass); }
JudgmentImportProcessReader implements ItemStreamReader<T> { @Override public T read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException { Long rJudgmentId = rJudgmentIds.poll(); if (rJudgmentId == null) { return null; } return rawSourceJudgmentRepository.findOne(rJudgmentId, judgmentClass); } }
JudgmentImportProcessReader implements ItemStreamReader<T> { @Override public T read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException { Long rJudgmentId = rJudgmentIds.poll(); if (rJudgmentId == null) { return null; } return rawSourceJudgmentRepository.findOne(rJudgmentId, judgmentClass); } JudgmentImportProcessReader(Class<T> judgmentClass); }
JudgmentImportProcessReader implements ItemStreamReader<T> { @Override public T read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException { Long rJudgmentId = rJudgmentIds.poll(); if (rJudgmentId == null) { return null; } return rawSourceJudgmentRepository.findOne(rJudgmentId, judgmentClass); } JudgmentImportProcessReader(Class<T> judgmentClass); @Override T read(); @Override void open(ExecutionContext executionContext); @Override void update(ExecutionContext executionContext); @Override void close(); @Autowired void setRawSourceJudgmentRepository(RawSourceJudgmentRepository rawSourceJudgmentRepository); }
JudgmentImportProcessReader implements ItemStreamReader<T> { @Override public T read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException { Long rJudgmentId = rJudgmentIds.poll(); if (rJudgmentId == null) { return null; } return rawSourceJudgmentRepository.findOne(rJudgmentId, judgmentClass); } JudgmentImportProcessReader(Class<T> judgmentClass); @Override T read(); @Override void open(ExecutionContext executionContext); @Override void update(ExecutionContext executionContext); @Override void close(); @Autowired void setRawSourceJudgmentRepository(RawSourceJudgmentRepository rawSourceJudgmentRepository);  }