void (Collection<UsageInfo> usages, String... usageTexts) { assertEquals(usageTexts.length, usages.size()); List<UsageInfo> sortedUsages = new ArrayList<>(usages); Collections.sort(sortedUsages, Comparator.comparingInt(o -> o.getElement().getTextRange().getStartOffset())); for (int i = 0; i < usageTexts.length; i++) { assertSameUsage(usageTexts[i], sortedUsages.get(i)); } }