### Question:
UpdateEnrichmentHashWriter implements ItemWriter<JudgmentEnrichmentHash> { @Override public void write(List<? extends JudgmentEnrichmentHash> enrichmentHashes) throws Exception { judgmentEnrichmentHashRepository.save(enrichmentHashes); judgmentEnrichmentHashRepository.flush(); entityManager.clear(); }  @Override void write(List<? extends JudgmentEnrichmentHash> enrichmentHashes); @Autowired void setJudgmentEnrichmentHashRepository(JudgmentEnrichmentHashRepository judgmentEnrichmentHashRepository); @Autowired void setEntityManager(EntityManager entityManager);  }### Answer:
@Test public void write() throws Exception { JudgmentEnrichmentHash hash1 = new JudgmentEnrichmentHash(); JudgmentEnrichmentHash hash2 = new JudgmentEnrichmentHash(); List<JudgmentEnrichmentHash> hashes = Lists.newArrayList(hash1, hash2); updateEnrichmentHashWriter.write(hashes); InOrder inOrder = inOrder(judgmentEnrichmentHashRepository, entityManager); inOrder.verify(judgmentEnrichmentHashRepository).save(hashes); inOrder.verify(judgmentEnrichmentHashRepository).flush(); inOrder.verify(entityManager).clear(); }