void (final int selected, final String @NotNull ... expected) { final LookupImpl lookup = getLookup(); assertNotNull("No lookup is shown", lookup); final JList<LookupElement> list = lookup.getList(); List<String> strings = getLookupElementStrings(); assertNotNull(strings); final List<String> actual = ContainerUtil.getFirstItems(strings, expected.length); if (!actual.equals(Arrays.asList(expected))) { UsefulTestCase.assertOrderedEquals(DumpLookupElementWeights.getLookupElementWeights(lookup, false), expected); } if (selected != list.getSelectedIndex()) { //noinspection UseOfSystemOutOrSystemErr DumpLookupElementWeights.getLookupElementWeights(lookup, false).forEach(System.out::println); } assertEquals(selected, list.getSelectedIndex()); }