void (String directory) { CamelHumpMatcher.forceStartMatching(myFixture.getTestRootDisposable()); final List<String> stringList = TestUtils.readInput(getTestDataPath() + "/" + getTestName(true) + ".test"); if (directory.length()!=0) directory += "/"; final String fileName = directory + getTestName(true) + "." + getExtension(); myFixture.addFileToProject(fileName, stringList.get(0)); myFixture.configureByFile(fileName); CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_CODE_COMPLETION = false; StringBuilder result = new StringBuilder(); try { myFixture.completeBasic(); final LookupImpl lookup = (LookupImpl)LookupManager.getActiveLookup(myFixture.getEditor()); if (lookup != null) { List<LookupElement> items = lookup.getItems(); if (!addReferenceVariants()) { items = ContainerUtil.findAll(items, lookupElement -> { final Object o = lookupElement.getObject(); return !(o instanceof PsiMember) && !(o instanceof GrVariable) && !(o instanceof GroovyResolveResult) && !(o instanceof PsiPackage); }); } Collections.sort(items, Comparator.comparing(LookupElement::getLookupString)); result = new StringBuilder(); for (LookupElement item : items) { result.append("\n").append(item.getLookupString()); } result = new StringBuilder(result.toString().trim()); LookupManager.hideActiveLookup(myFixture.getProject()); } } finally { CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_CODE_COMPLETION = true; } assertEquals(StringUtil.trimEnd(stringList.get(1), "\n"), result.toString()); }