void () { myFixture.addClass("public class Bar {}"); for (int i = 0; i < 10; i++) { myFixture.addClass("public class Bar" + i + " {}"); myFixture.addClass("public class Bar" + i + "Colleague {}"); } myFixture.addClass("package bar; public class Bar {}"); myFixture.configureByFile(getTestName(false) + ".java"); myFixture.complete(CompletionType.BASIC, 2); assertPreferredItems(0, "Bar", "Bar"); List<LookupElement> items = getLookup().getItems(); TestCase.assertEquals(((JavaPsiClassReferenceElement)items.get(0)).getQualifiedName(), "Bar"); TestCase.assertEquals(((JavaPsiClassReferenceElement)items.get(1)).getQualifiedName(), "bar.Bar"); }