use of org.sonar.server.issue.index.IssueQuery in project sonarqube by SonarSource.
the class IssuesFinderSortTest method should_sort_by_severity.
@Test
public void should_sort_by_severity() {
IssueDto issue1 = new IssueDto().setKee("A").setSeverity("INFO");
IssueDto issue2 = new IssueDto().setKee("B").setSeverity("BLOCKER");
IssueDto issue3 = new IssueDto().setKee("C").setSeverity("MAJOR");
List<IssueDto> dtoList = newArrayList(issue1, issue2, issue3);
IssueQuery query = IssueQuery.builder().sort(IssueQuery.SORT_BY_SEVERITY).asc(true).build();
IssuesFinderSort issuesFinderSort = new IssuesFinderSort(dtoList, query);
List<IssueDto> result = newArrayList(issuesFinderSort.sort());
assertThat(result).hasSize(3);
assertThat(result.get(0).getSeverity()).isEqualTo("INFO");
assertThat(result.get(1).getSeverity()).isEqualTo("MAJOR");
assertThat(result.get(2).getSeverity()).isEqualTo("BLOCKER");
}
Aggregations