@Test public void sortJudges_multiple_roles() { JudgeResult judgeResultOne = new JudgeResult("Aleksandra Żurowska"); JudgeResult judgeResultTwo = new JudgeResult("Anatol Rajczkowski", Judge.JudgeRole.REASONS_FOR_JUDGMENT_AUTHOR, Judge.JudgeRole.REPORTING_JUDGE); JudgeResult judgeResultThree = new JudgeResult("Julia Ufnalewska", Judge.JudgeRole.REASONS_FOR_JUDGMENT_AUTHOR, Judge.JudgeRole.PRESIDING_JUDGE); JudgeResult judgeResultFour = new JudgeResult("Leszek Kołodziński", Judge.JudgeRole.REPORTING_JUDGE, Judge.JudgeRole.PRESIDING_JUDGE); List<JudgeResult> unsortedJudgeResults = Lists.newArrayList(judgeResultOne, judgeResultTwo, judgeResultThree, judgeResultFour); SearchResults<JudgmentSearchResult> searchResults = new SearchResults<JudgmentSearchResult>(); JudgmentSearchResult judgmentSearchResult = new JudgmentSearchResult(); judgmentSearchResult.setJudges(unsortedJudgeResults); searchResults.addResult(judgmentSearchResult); List<JudgeResult> sortedJudgeResults = judgmentSearchResultSortService.sortJudges(searchResults).getResults().get(0).getJudges(); assertEquals(4, sortedJudgeResults.size()); assertEquals(judgeResultThree, sortedJudgeResults.get(0)); assertEquals(judgeResultFour, sortedJudgeResults.get(1)); assertEquals(judgeResultOne, sortedJudgeResults.get(2)); assertEquals(judgeResultTwo, sortedJudgeResults.get(3)); }
public SearchResults<JudgmentSearchResult> sortJudges(SearchResults<JudgmentSearchResult> searchResults) { searchResults.getResults().forEach(p -> p.setJudges(sortJudges(p).getJudges())); return searchResults; }
JudgmentSearchResultSortService { public SearchResults<JudgmentSearchResult> sortJudges(SearchResults<JudgmentSearchResult> searchResults) { searchResults.getResults().forEach(p -> p.setJudges(sortJudges(p).getJudges())); return searchResults; } }
JudgmentSearchResultSortService { public SearchResults<JudgmentSearchResult> sortJudges(SearchResults<JudgmentSearchResult> searchResults) { searchResults.getResults().forEach(p -> p.setJudges(sortJudges(p).getJudges())); return searchResults; }  }
JudgmentSearchResultSortService { public SearchResults<JudgmentSearchResult> sortJudges(SearchResults<JudgmentSearchResult> searchResults) { searchResults.getResults().forEach(p -> p.setJudges(sortJudges(p).getJudges())); return searchResults; }  SearchResults<JudgmentSearchResult> sortJudges(SearchResults<JudgmentSearchResult> searchResults); }
JudgmentSearchResultSortService { public SearchResults<JudgmentSearchResult> sortJudges(SearchResults<JudgmentSearchResult> searchResults) { searchResults.getResults().forEach(p -> p.setJudges(sortJudges(p).getJudges())); return searchResults; }  SearchResults<JudgmentSearchResult> sortJudges(SearchResults<JudgmentSearchResult> searchResults);  }