@Test public void findByJugmentId_CommonCourtJudgment() { int judgmentId = 123; List<JudgmentCorrection> unsortedJc = Lists.newArrayList(); unsortedJc.add(createJcJudgeDelete(ccJudgment)); unsortedJc.add(createJcCommonCourtJudgment()); unsortedJc.add(createJcJudgeUpdate(ccJudgment)); List<JudgmentCorrection> expectedJc = Lists.newArrayList(); expectedJc.add(createJcCommonCourtJudgment()); expectedJc.add(createJcJudgeUpdate(ccJudgment)); expectedJc.add(createJcJudgeDelete(ccJudgment)); when(judgmentCorrectionRepository.findAllByJudgmentId(judgmentId)).thenReturn(unsortedJc); List<JudgmentCorrection> actualJc = judgmentCorrectionService.findAllByJudgmentIdSorted(judgmentId); assertEquals(expectedJc, actualJc); }
public List<JudgmentCorrection> findAllByJudgmentIdSorted(long judgmentId) { List<JudgmentCorrection> judgmentCorrections = judgmentCorrectionRepository.findAllByJudgmentId(judgmentId); Collections.sort(judgmentCorrections, new JudgmentCorrectionComparator()); return judgmentCorrections; }
JudgmentCorrectionService { public List<JudgmentCorrection> findAllByJudgmentIdSorted(long judgmentId) { List<JudgmentCorrection> judgmentCorrections = judgmentCorrectionRepository.findAllByJudgmentId(judgmentId); Collections.sort(judgmentCorrections, new JudgmentCorrectionComparator()); return judgmentCorrections; } }
JudgmentCorrectionService { public List<JudgmentCorrection> findAllByJudgmentIdSorted(long judgmentId) { List<JudgmentCorrection> judgmentCorrections = judgmentCorrectionRepository.findAllByJudgmentId(judgmentId); Collections.sort(judgmentCorrections, new JudgmentCorrectionComparator()); return judgmentCorrections; }  }
JudgmentCorrectionService { public List<JudgmentCorrection> findAllByJudgmentIdSorted(long judgmentId) { List<JudgmentCorrection> judgmentCorrections = judgmentCorrectionRepository.findAllByJudgmentId(judgmentId); Collections.sort(judgmentCorrections, new JudgmentCorrectionComparator()); return judgmentCorrections; }  List<JudgmentCorrection> findAllByJudgmentIdSorted(long judgmentId); @Autowired void setJudgmentCorrectionRepository(JudgmentCorrectionRepository judgmentCorrectionRepository); }
JudgmentCorrectionService { public List<JudgmentCorrection> findAllByJudgmentIdSorted(long judgmentId) { List<JudgmentCorrection> judgmentCorrections = judgmentCorrectionRepository.findAllByJudgmentId(judgmentId); Collections.sort(judgmentCorrections, new JudgmentCorrectionComparator()); return judgmentCorrections; }  List<JudgmentCorrection> findAllByJudgmentIdSorted(long judgmentId); @Autowired void setJudgmentCorrectionRepository(JudgmentCorrectionRepository judgmentCorrectionRepository);  }