### Question:
UpdateEnrichmentHashReader implements ItemStreamReader<JudgmentEnrichmentTags> { @Override public JudgmentEnrichmentTags read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException { JudgmentEnrichmentTags judgmentEnrichmentTags = judgmentsEnrichmentTags.poll(); if (judgmentEnrichmentTags == null && judgmentIds.isEmpty()) { return null; } if (judgmentEnrichmentTags == null) { fetchPageOfJudgmentsEnrichmentTags(); return read(); } return judgmentEnrichmentTags; }  @Override void open(ExecutionContext executionContext); @Override JudgmentEnrichmentTags read(); @Override void update(ExecutionContext executionContext); @Override void close(); @Autowired void setJudgmentRepository(JudgmentRepository judgmentRepository); @Autowired void setJudgmentEnrichmentTagsFetcher(JudgmentEnrichmentTagsFetcher judgmentsToRecalculateHashFetcher); @Value("${enrichment.hash.calculate.page.size:5000}") void setJudgmentsEnrichmentTagsPageSize(int judgmentsEnrichmentTagsPageSize);  }### Answer:
@Test public void read() throws Exception { JudgmentEnrichmentTags judgmentEnrichmentTags1 = new JudgmentEnrichmentTags(1L); JudgmentEnrichmentTags judgmentEnrichmentTags2 = new JudgmentEnrichmentTags(2L); JudgmentEnrichmentTags judgmentEnrichmentTags3 = new JudgmentEnrichmentTags(3L); when(judgmentRepository.findAllIds()).thenReturn(Lists.newArrayList(1L, 2L, 3L)); when(judgmentEnrichmentTagsFetcher.fetchEnrichmentTagsForJudgments(Lists.newArrayList(1L, 2L))) .thenReturn(Lists.newArrayList(judgmentEnrichmentTags1, judgmentEnrichmentTags2)); when(judgmentEnrichmentTagsFetcher.fetchEnrichmentTagsForJudgments(Lists.newArrayList(3L))) .thenReturn(Lists.newArrayList(judgmentEnrichmentTags3)); updateEnrichmentHashReader.open(mock(ExecutionContext.class)); JudgmentEnrichmentTags retJudgmentEnrichmentTags1 = updateEnrichmentHashReader.read(); JudgmentEnrichmentTags retJudgmentEnrichmentTags2 = updateEnrichmentHashReader.read(); JudgmentEnrichmentTags retJudgmentEnrichmentTags3 = updateEnrichmentHashReader.read(); JudgmentEnrichmentTags retJudgmentEnrichmentTags4 = updateEnrichmentHashReader.read(); assertTrue(judgmentEnrichmentTags1 == retJudgmentEnrichmentTags1); assertTrue(judgmentEnrichmentTags2 == retJudgmentEnrichmentTags2); assertTrue(judgmentEnrichmentTags3 == retJudgmentEnrichmentTags3); assertNull(retJudgmentEnrichmentTags4); }