@Test public void process_NEW_HASH() throws Exception { JudgmentEnrichmentTags judgmentEnrichmentTags = new JudgmentEnrichmentTags(2L); when(judgmentEnrichmentTagsHashCalculator.calculateHash(judgmentEnrichmentTags)).thenReturn("hash"); when(judgmentEnrichmentHashRepository.findByJudgmentId(2L)).thenReturn(null); JudgmentEnrichmentHash retJudgmentEnrichmentHash = updateEnrichmentHashProcessor.process(judgmentEnrichmentTags); assertEquals(2L, retJudgmentEnrichmentHash.getJudgmentId()); assertEquals(null, retJudgmentEnrichmentHash.getOldHash()); assertEquals("hash", retJudgmentEnrichmentHash.getHash()); assertFalse(retJudgmentEnrichmentHash.isProcessed()); }
@Override public JudgmentEnrichmentHash process(JudgmentEnrichmentTags judgmentEnrichmentTags) throws Exception { JudgmentEnrichmentHash enrichmentHash = judgmentEnrichmentHashRepository.findByJudgmentId(judgmentEnrichmentTags.getJudgmentId()); if (enrichmentHash == null) { enrichmentHash = new JudgmentEnrichmentHash(); enrichmentHash.setJudgmentId(judgmentEnrichmentTags.getJudgmentId()); } String hash = judgmentEnrichmentTagsHashCalculator.calculateHash(judgmentEnrichmentTags); enrichmentHash.updateHash(hash); return enrichmentHash; }
UpdateEnrichmentHashProcessor implements ItemProcessor<JudgmentEnrichmentTags, JudgmentEnrichmentHash> { @Override public JudgmentEnrichmentHash process(JudgmentEnrichmentTags judgmentEnrichmentTags) throws Exception { JudgmentEnrichmentHash enrichmentHash = judgmentEnrichmentHashRepository.findByJudgmentId(judgmentEnrichmentTags.getJudgmentId()); if (enrichmentHash == null) { enrichmentHash = new JudgmentEnrichmentHash(); enrichmentHash.setJudgmentId(judgmentEnrichmentTags.getJudgmentId()); } String hash = judgmentEnrichmentTagsHashCalculator.calculateHash(judgmentEnrichmentTags); enrichmentHash.updateHash(hash); return enrichmentHash; } }
UpdateEnrichmentHashProcessor implements ItemProcessor<JudgmentEnrichmentTags, JudgmentEnrichmentHash> { @Override public JudgmentEnrichmentHash process(JudgmentEnrichmentTags judgmentEnrichmentTags) throws Exception { JudgmentEnrichmentHash enrichmentHash = judgmentEnrichmentHashRepository.findByJudgmentId(judgmentEnrichmentTags.getJudgmentId()); if (enrichmentHash == null) { enrichmentHash = new JudgmentEnrichmentHash(); enrichmentHash.setJudgmentId(judgmentEnrichmentTags.getJudgmentId()); } String hash = judgmentEnrichmentTagsHashCalculator.calculateHash(judgmentEnrichmentTags); enrichmentHash.updateHash(hash); return enrichmentHash; }  }
UpdateEnrichmentHashProcessor implements ItemProcessor<JudgmentEnrichmentTags, JudgmentEnrichmentHash> { @Override public JudgmentEnrichmentHash process(JudgmentEnrichmentTags judgmentEnrichmentTags) throws Exception { JudgmentEnrichmentHash enrichmentHash = judgmentEnrichmentHashRepository.findByJudgmentId(judgmentEnrichmentTags.getJudgmentId()); if (enrichmentHash == null) { enrichmentHash = new JudgmentEnrichmentHash(); enrichmentHash.setJudgmentId(judgmentEnrichmentTags.getJudgmentId()); } String hash = judgmentEnrichmentTagsHashCalculator.calculateHash(judgmentEnrichmentTags); enrichmentHash.updateHash(hash); return enrichmentHash; }  @Override JudgmentEnrichmentHash process(JudgmentEnrichmentTags judgmentEnrichmentTags); @Autowired void setJudgmentEnrichmentTagsHashCalculator(
            JudgmentEnrichmentTagsHashCalculator judgmentEnrichmentTagsHashCalculator); @Autowired void setJudgmentEnrichmentHashRepository(
            JudgmentEnrichmentHashRepository judgmentEnrichmentHashRepository); }
UpdateEnrichmentHashProcessor implements ItemProcessor<JudgmentEnrichmentTags, JudgmentEnrichmentHash> { @Override public JudgmentEnrichmentHash process(JudgmentEnrichmentTags judgmentEnrichmentTags) throws Exception { JudgmentEnrichmentHash enrichmentHash = judgmentEnrichmentHashRepository.findByJudgmentId(judgmentEnrichmentTags.getJudgmentId()); if (enrichmentHash == null) { enrichmentHash = new JudgmentEnrichmentHash(); enrichmentHash.setJudgmentId(judgmentEnrichmentTags.getJudgmentId()); } String hash = judgmentEnrichmentTagsHashCalculator.calculateHash(judgmentEnrichmentTags); enrichmentHash.updateHash(hash); return enrichmentHash; }  @Override JudgmentEnrichmentHash process(JudgmentEnrichmentTags judgmentEnrichmentTags); @Autowired void setJudgmentEnrichmentTagsHashCalculator(
            JudgmentEnrichmentTagsHashCalculator judgmentEnrichmentTagsHashCalculator); @Autowired void setJudgmentEnrichmentHashRepository(
            JudgmentEnrichmentHashRepository judgmentEnrichmentHashRepository);  }