void () { myFixture.configureByText("a.java", "public class Test1 {<caret>} public class Test2 {}"); TestApplicationManager testApplication = TestApplicationManager.getInstance(); try { testApplication.setDataProvider(new TestDataProvider(myFixture.getProject()) { @Override public Object getData(@NotNull @NonNls String dataId) { if (CommonDataKeys.VIRTUAL_FILE_ARRAY.is(dataId)) { return new VirtualFile[] {myFixture.getFile().getVirtualFile()}; } return super.getData(dataId); } }); final PsiElement psiElement = myFixture.getFile().findElementAt(getEditor().getCaretModel().getOffset()); final PatternConfigurationProducer configurationProducer = RunConfigurationProducer.getInstance(PatternConfigurationProducer.class); assertFalse(configurationProducer.isMultipleElementsSelected(new ConfigurationContext(psiElement))); } finally { testApplication.setDataProvider(null); } }