void () { @NonNls String text = "import xxx.yyy; class S { } <caret> "; configureByText(text); CodeInsightWorkspaceSettings.getInstance(getProject()).setOptimizeImportsOnTheFly(true, getTestRootDisposable()); DaemonCodeAnalyzerSettings.getInstance().setImportHintEnabled(true); List<HighlightInfo> errs = highlightErrors(); //error in import list assertEquals(1, errs.size()); assertEquals(1, ((PsiJavaFile)getFile()).getImportList().getAllImportStatements().length); type("/* */"); doHighlighting(); UIUtil.dispatchAllInvocationEvents(); assertNoImportsAdded(); }