void (String @NotNull [] fileNames, final List<? extends PsiFile> filesList, int[] starts, final IntList startsList, int[] ends, final IntList endsList) { List<SearchResult> expected = new ArrayList<>(); for (int i = 0; i < fileNames.length; i++) { String fileName = fileNames[i]; expected.add(new SearchResult(fileName, i < starts.length ? starts[i] : -1, i < ends.length ? ends[i] : -1)); } List<SearchResult> actual = new ArrayList<>(); for (int i = 0; i < filesList.size(); i++) { PsiFile psiFile = filesList.get(i); actual.add( new SearchResult(psiFile.getName(), i < starts.length ? startsList.getInt(i) : -1, i < ends.length ? endsList.getInt(i) : -1)); } Collections.sort(expected); Collections.sort(actual); assertEquals("Usages don't match", expected, actual); }