@Test public void findByJugmentId_SupremeCourtJudgment() { int judgmentId = 124; List<JudgmentCorrection> unsortedJc = Lists.newArrayList(); unsortedJc.add(createJcSupremeCourtChamber()); unsortedJc.add(createJcJudgeDelete(scJudgment)); unsortedJc.add(createJcSupremeCourtJudgmentForm()); unsortedJc.add(createJcSupremeCourtJudgment()); unsortedJc.add(createJcJudgeUpdate(scJudgment)); List<JudgmentCorrection> expectedJc = Lists.newArrayList(); expectedJc.add(createJcSupremeCourtJudgment()); expectedJc.add(createJcSupremeCourtChamber()); expectedJc.add(createJcSupremeCourtJudgmentForm()); expectedJc.add(createJcJudgeUpdate(scJudgment)); expectedJc.add(createJcJudgeDelete(scJudgment)); 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);  }