void () { boolean completeByChars = CodeInsightSettings.getInstance().SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS; CodeInsightSettings.getInstance().SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS = true; try { skipComplete.set(true); try { configureByFile(getBeforeFileName()); } finally { skipComplete.set(false); } String text = getEditor().getDocument().getText(); boolean noLookup = InTextDirectivesUtils.isDirectiveDefined(text, "// NO_LOOKUP"); if (!noLookup) complete(); //This will cause NPE in case of absence of autopopup completion List<String> expectedElements = InTextDirectivesUtils.findLinesWithPrefixesRemoved(text, "// ELEMENT:"); assertFalse("Can't both expect lookup elements and no lookup", !expectedElements.isEmpty() && noLookup); if (noLookup) { assertTrue("Should skip autopopup completion", shouldSkipAutoPopup(getEditor(), getFile())); return; } String typeText = getTypeText(text); if (!expectedElements.isEmpty()) { assertContainsItems(ArrayUtil.toStringArray(expectedElements)); return; } assertNotNull("You must type something, use // TYPE:", typeText); type(typeText); checkResultByFile(getAfterFileName()); } finally { CodeInsightSettings.getInstance().SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS = completeByChars; } }