@Test public void processJudgment_New() { ccJudgment.getSourceInfo().setSourceCode(SourceCode.COMMON_COURT); ccJudgment.getSourceInfo().setSourceJudgmentId("1232345"); when(sourceCcJudgmentConverter.convertJudgment(Mockito.isA(SourceCcJudgment.class))).thenReturn(jWithCorrectionList); when(ccJudgmentRepository.findOneBySourceCodeAndSourceJudgmentId(Mockito.eq(ccJudgment.getSourceInfo().getSourceCode()), Mockito.eq(ccJudgment.getSourceInfo().getSourceJudgmentId()))).thenReturn(null); JudgmentWithCorrectionList<CommonCourtJudgment> retJWithCorrectionList = ccjProcessingService.processJudgment(sourceCcJudgment); assertTrue(jWithCorrectionList == retJWithCorrectionList); ArgumentCaptor<SourceCcJudgment> argSourceCcJudgment = ArgumentCaptor.forClass(SourceCcJudgment.class); verify(sourceCcJudgmentConverter).convertJudgment(argSourceCcJudgment.capture()); assertTrue(sourceCcJudgment == argSourceCcJudgment.getValue()); verify(ccJudgmentRepository).findOneBySourceCodeAndSourceJudgmentId(Mockito.eq(ccJudgment.getSourceInfo().getSourceCode()), Mockito.eq(ccJudgment.getSourceInfo().getSourceJudgmentId())); }
public JudgmentWithCorrectionList<CommonCourtJudgment> processJudgment(SourceCcJudgment sourceCcJudgment) { JudgmentWithCorrectionList<CommonCourtJudgment> judgmentWithCorrectionList = sourceCcJudgmentConverter.convertJudgment(sourceCcJudgment); CommonCourtJudgment ccJudgment = judgmentWithCorrectionList.getJudgment(); CommonCourtJudgment oldJudgment = ccJudgmentRepository.findOneBySourceCodeAndSourceJudgmentId(ccJudgment.getSourceInfo().getSourceCode(), ccJudgment.getSourceInfo().getSourceJudgmentId()); if (oldJudgment != null) { judgmentOverwriter.overwriteJudgment(oldJudgment, ccJudgment, judgmentWithCorrectionList.getCorrectionList()); enrichmentTagRepository.deleteAllByJudgmentId(oldJudgment.getId()); judgmentWithCorrectionList.setJudgment(oldJudgment); } return judgmentWithCorrectionList; }
CcjProcessingService { public JudgmentWithCorrectionList<CommonCourtJudgment> processJudgment(SourceCcJudgment sourceCcJudgment) { JudgmentWithCorrectionList<CommonCourtJudgment> judgmentWithCorrectionList = sourceCcJudgmentConverter.convertJudgment(sourceCcJudgment); CommonCourtJudgment ccJudgment = judgmentWithCorrectionList.getJudgment(); CommonCourtJudgment oldJudgment = ccJudgmentRepository.findOneBySourceCodeAndSourceJudgmentId(ccJudgment.getSourceInfo().getSourceCode(), ccJudgment.getSourceInfo().getSourceJudgmentId()); if (oldJudgment != null) { judgmentOverwriter.overwriteJudgment(oldJudgment, ccJudgment, judgmentWithCorrectionList.getCorrectionList()); enrichmentTagRepository.deleteAllByJudgmentId(oldJudgment.getId()); judgmentWithCorrectionList.setJudgment(oldJudgment); } return judgmentWithCorrectionList; } }
CcjProcessingService { public JudgmentWithCorrectionList<CommonCourtJudgment> processJudgment(SourceCcJudgment sourceCcJudgment) { JudgmentWithCorrectionList<CommonCourtJudgment> judgmentWithCorrectionList = sourceCcJudgmentConverter.convertJudgment(sourceCcJudgment); CommonCourtJudgment ccJudgment = judgmentWithCorrectionList.getJudgment(); CommonCourtJudgment oldJudgment = ccJudgmentRepository.findOneBySourceCodeAndSourceJudgmentId(ccJudgment.getSourceInfo().getSourceCode(), ccJudgment.getSourceInfo().getSourceJudgmentId()); if (oldJudgment != null) { judgmentOverwriter.overwriteJudgment(oldJudgment, ccJudgment, judgmentWithCorrectionList.getCorrectionList()); enrichmentTagRepository.deleteAllByJudgmentId(oldJudgment.getId()); judgmentWithCorrectionList.setJudgment(oldJudgment); } return judgmentWithCorrectionList; }  }
CcjProcessingService { public JudgmentWithCorrectionList<CommonCourtJudgment> processJudgment(SourceCcJudgment sourceCcJudgment) { JudgmentWithCorrectionList<CommonCourtJudgment> judgmentWithCorrectionList = sourceCcJudgmentConverter.convertJudgment(sourceCcJudgment); CommonCourtJudgment ccJudgment = judgmentWithCorrectionList.getJudgment(); CommonCourtJudgment oldJudgment = ccJudgmentRepository.findOneBySourceCodeAndSourceJudgmentId(ccJudgment.getSourceInfo().getSourceCode(), ccJudgment.getSourceInfo().getSourceJudgmentId()); if (oldJudgment != null) { judgmentOverwriter.overwriteJudgment(oldJudgment, ccJudgment, judgmentWithCorrectionList.getCorrectionList()); enrichmentTagRepository.deleteAllByJudgmentId(oldJudgment.getId()); judgmentWithCorrectionList.setJudgment(oldJudgment); } return judgmentWithCorrectionList; }  JudgmentWithCorrectionList<CommonCourtJudgment> processJudgment(SourceCcJudgment sourceCcJudgment); @Autowired void setCcJudgmentRepository(CcJudgmentRepository ccJudgmentRepository); @Autowired @Qualifier("ccJudgmentOverwriter") void setJudgmentOverwriter(JudgmentOverwriter<CommonCourtJudgment> ccJudgmentOverwriter); @Autowired @Qualifier("sourceCcJudgmentConverter") void setSourceCcJudgmentConverter(JudgmentConverter<CommonCourtJudgment, SourceCcJudgment> sourceCcJudgmentConverter); @Autowired void setEnrichmentTagRepository(EnrichmentTagRepository enrichmentTagRepository); }
CcjProcessingService { public JudgmentWithCorrectionList<CommonCourtJudgment> processJudgment(SourceCcJudgment sourceCcJudgment) { JudgmentWithCorrectionList<CommonCourtJudgment> judgmentWithCorrectionList = sourceCcJudgmentConverter.convertJudgment(sourceCcJudgment); CommonCourtJudgment ccJudgment = judgmentWithCorrectionList.getJudgment(); CommonCourtJudgment oldJudgment = ccJudgmentRepository.findOneBySourceCodeAndSourceJudgmentId(ccJudgment.getSourceInfo().getSourceCode(), ccJudgment.getSourceInfo().getSourceJudgmentId()); if (oldJudgment != null) { judgmentOverwriter.overwriteJudgment(oldJudgment, ccJudgment, judgmentWithCorrectionList.getCorrectionList()); enrichmentTagRepository.deleteAllByJudgmentId(oldJudgment.getId()); judgmentWithCorrectionList.setJudgment(oldJudgment); } return judgmentWithCorrectionList; }  JudgmentWithCorrectionList<CommonCourtJudgment> processJudgment(SourceCcJudgment sourceCcJudgment); @Autowired void setCcJudgmentRepository(CcJudgmentRepository ccJudgmentRepository); @Autowired @Qualifier("ccJudgmentOverwriter") void setJudgmentOverwriter(JudgmentOverwriter<CommonCourtJudgment> ccJudgmentOverwriter); @Autowired @Qualifier("sourceCcJudgmentConverter") void setSourceCcJudgmentConverter(JudgmentConverter<CommonCourtJudgment, SourceCcJudgment> sourceCcJudgmentConverter); @Autowired void setEnrichmentTagRepository(EnrichmentTagRepository enrichmentTagRepository);  }