Search in sources :

Example 1 with IdeaTestApplication

use of com.intellij.idea.IdeaTestApplication in project intellij-community by JetBrains.

the class JUnitRerunFailedTestsTest method testMultipleClassesInOneFile.

public void testMultipleClassesInOneFile() throws Exception {
    myFixture.configureByText("a.java", "public class Test1 {<caret>} public class Test2 {}");
    final IdeaTestApplication testApplication = IdeaTestApplication.getInstance();
    try {
        testApplication.setDataProvider(new TestDataProvider(myFixture.getProject()) {

            @Override
            public Object getData(@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);
    }
}
Also used : ConfigurationContext(com.intellij.execution.actions.ConfigurationContext) IdeaTestApplication(com.intellij.idea.IdeaTestApplication) TestDataProvider(com.intellij.testFramework.TestDataProvider) PsiElement(com.intellij.psi.PsiElement)

Example 2 with IdeaTestApplication

use of com.intellij.idea.IdeaTestApplication in project intellij-community by JetBrains.

the class LightIdeaTestFixtureImpl method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    IdeaTestApplication application = LightPlatformTestCase.initApplication();
    LightPlatformTestCase.doSetup(myProjectDescriptor, LocalInspectionTool.EMPTY_ARRAY, getTestRootDisposable());
    InjectedLanguageManagerImpl.pushInjectors(getProject());
    myOldCodeStyleSettings = getCurrentCodeStyleSettings().clone();
    myOldCodeStyleSettings.getIndentOptions(StdFileTypes.JAVA);
    application.setDataProvider(new TestDataProvider(getProject()));
}
Also used : IdeaTestApplication(com.intellij.idea.IdeaTestApplication)

Example 3 with IdeaTestApplication

use of com.intellij.idea.IdeaTestApplication in project android by JetBrains.

the class AsyncValidatorTest method setUp.

@Before
public void setUp() throws Exception {
    // This should happen on some other thread - it will become the AWT event queue thread.
    ThreadPoolExecutor executor = ConcurrencyUtil.newSingleThreadExecutor("async validator test");
    Future<IdeaTestApplication> application = executor.submit((Callable<IdeaTestApplication>) IdeaTestApplication::getInstance);
    // Wait for the application instantiation
    application.get();
}
Also used : IdeaTestApplication(com.intellij.idea.IdeaTestApplication) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) Before(org.junit.Before)

Aggregations

IdeaTestApplication (com.intellij.idea.IdeaTestApplication)3 ConfigurationContext (com.intellij.execution.actions.ConfigurationContext)1 PsiElement (com.intellij.psi.PsiElement)1 TestDataProvider (com.intellij.testFramework.TestDataProvider)1 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1 Before (org.junit.Before)1