void (Collection<UsageInfo> usages, String... usageTexts) { assertEquals(usageTexts.length, usages.size()); List<UsageInfo> sortedUsages = new ArrayList<>(usages); sortedUsages.sort(UsageInfo::compareToByStartOffset); for (int i = 0; i < usageTexts.length; i++) { assertEquals(usageTexts[i], sortedUsages.get(i).getElement().getText().replaceAll("\\s*", "")); } }