void () { @NonNls String text = "package x; class S {{ S.<caret>\n Runnable r; }}"; configureByText(text); CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = true; CodeInsightWorkspaceSettings.getInstance(getProject()).setOptimizeImportsOnTheFly(true, getTestRootDisposable()); assertEquals(1, highlightErrors().size()); }