void () { checkPreferredItems(0, "String", "Usage"); int typeArgOffset = myFixture.getEditor().getCaretModel().getOffset(); // increase usage stats of ArrayList LookupManager.getInstance(getProject()).hideActiveLookup(); myFixture.performEditorAction(IdeActions.ACTION_EDITOR_MOVE_LINE_END); myFixture.type("\nArrayLi"); myFixture.completeBasic(); myFixture.type(" l"); myFixture.completeBasic(); myFixture.type("\n;"); assertTrue(myFixture.getEditor().getDocument().getText().contains("ArrayList list;")); // check String is still preferred myFixture.getEditor().getCaretModel().moveToOffset(typeArgOffset); myFixture.completeBasic(); myFixture.assertPreferredCompletionItems(0, "String", "Usage"); }