Search in sources :

Example 1 with EditorTestHelper

use of com.google.idea.blaze.base.EditorTestHelper in project intellij by bazelbuild.

the class BlazeRunConfigurationProducerTestCase method doSetup.

@Before
public final void doSetup() {
    BlazeProjectDataManager mockProjectDataManager = new MockBlazeProjectDataManager(MockBlazeProjectDataBuilder.builder(workspaceRoot).build());
    registerProjectService(BlazeProjectDataManager.class, mockProjectDataManager);
    editorTest = new EditorTestHelper(getProject(), testFixture);
    // IntelliJ replaces the normal DataManager with a mock version in headless environments.
    // We rely on a functional DataManager in run configuration tests to recognize when multiple
    // psi elements are selected.
    DataManager dataManager = new MyDataManagerImpl() {

        DataContext dataContext;

        @Override
        public <T> void saveInDataContext(DataContext dataContext, Key<T> dataKey, @Nullable T data) {
            this.dataContext = dataContext;
            super.saveInDataContext(dataContext, dataKey, data);
        }

        @Override
        public DataContext getDataContext() {
            return dataContext != null ? dataContext : super.getDataContext();
        }
    };
    registerApplicationComponent(DataManager.class, dataManager);
}
Also used : EditorTestHelper(com.google.idea.blaze.base.EditorTestHelper) MyDataManagerImpl(com.intellij.idea.CommandLineApplication.MyDataManagerImpl) DataContext(com.intellij.openapi.actionSystem.DataContext) MapDataContext(com.intellij.testFramework.MapDataContext) MockBlazeProjectDataManager(com.google.idea.blaze.base.model.MockBlazeProjectDataManager) BlazeProjectDataManager(com.google.idea.blaze.base.sync.data.BlazeProjectDataManager) MockBlazeProjectDataManager(com.google.idea.blaze.base.model.MockBlazeProjectDataManager) DataManager(com.intellij.ide.DataManager) BlazeProjectDataManager(com.google.idea.blaze.base.sync.data.BlazeProjectDataManager) MockBlazeProjectDataManager(com.google.idea.blaze.base.model.MockBlazeProjectDataManager) Key(com.intellij.openapi.util.Key) Nullable(javax.annotation.Nullable) Before(org.junit.Before)

Example 2 with EditorTestHelper

use of com.google.idea.blaze.base.EditorTestHelper in project intellij by bazelbuild.

the class BuildFileIntegrationTestCase method doSetup.

@Before
public final void doSetup() {
    BlazeProjectDataManager mockProjectDataManager = new MockBlazeProjectDataManager(MockBlazeProjectDataBuilder.builder(workspaceRoot).setOutputBase(fileSystem.getRootDir() + "/output_base").build());
    registerProjectService(BlazeProjectDataManager.class, mockProjectDataManager);
    editorTest = new EditorTestHelper(getProject(), testFixture);
}
Also used : EditorTestHelper(com.google.idea.blaze.base.EditorTestHelper) MockBlazeProjectDataManager(com.google.idea.blaze.base.model.MockBlazeProjectDataManager) BlazeProjectDataManager(com.google.idea.blaze.base.sync.data.BlazeProjectDataManager) MockBlazeProjectDataManager(com.google.idea.blaze.base.model.MockBlazeProjectDataManager) Before(org.junit.Before)

Example 3 with EditorTestHelper

use of com.google.idea.blaze.base.EditorTestHelper in project intellij by bazelbuild.

the class ProjectViewIntegrationTestCase method doSetup.

@Before
public final void doSetup() {
    BlazeProjectDataManager mockProjectDataManager = new MockBlazeProjectDataManager(MockBlazeProjectDataBuilder.builder(workspaceRoot).build());
    registerProjectService(BlazeProjectDataManager.class, mockProjectDataManager);
    editorTest = new EditorTestHelper(getProject(), testFixture);
}
Also used : EditorTestHelper(com.google.idea.blaze.base.EditorTestHelper) MockBlazeProjectDataManager(com.google.idea.blaze.base.model.MockBlazeProjectDataManager) BlazeProjectDataManager(com.google.idea.blaze.base.sync.data.BlazeProjectDataManager) MockBlazeProjectDataManager(com.google.idea.blaze.base.model.MockBlazeProjectDataManager) Before(org.junit.Before)

Example 4 with EditorTestHelper

use of com.google.idea.blaze.base.EditorTestHelper in project intellij by bazelbuild.

the class ProjectViewCompletionTest method doSetup.

@Before
public final void doSetup() {
    BlazeProjectDataManager mockProjectDataManager = new MockBlazeProjectDataManager(MockBlazeProjectDataBuilder.builder(workspaceRoot).build());
    registerProjectService(BlazeProjectDataManager.class, mockProjectDataManager);
    editorTest = new EditorTestHelper(getProject(), testFixture);
}
Also used : EditorTestHelper(com.google.idea.blaze.base.EditorTestHelper) MockBlazeProjectDataManager(com.google.idea.blaze.base.model.MockBlazeProjectDataManager) BlazeProjectDataManager(com.google.idea.blaze.base.sync.data.BlazeProjectDataManager) MockBlazeProjectDataManager(com.google.idea.blaze.base.model.MockBlazeProjectDataManager) Before(org.junit.Before)

Aggregations

EditorTestHelper (com.google.idea.blaze.base.EditorTestHelper)4 MockBlazeProjectDataManager (com.google.idea.blaze.base.model.MockBlazeProjectDataManager)4 BlazeProjectDataManager (com.google.idea.blaze.base.sync.data.BlazeProjectDataManager)4 Before (org.junit.Before)4 DataManager (com.intellij.ide.DataManager)1 MyDataManagerImpl (com.intellij.idea.CommandLineApplication.MyDataManagerImpl)1 DataContext (com.intellij.openapi.actionSystem.DataContext)1 Key (com.intellij.openapi.util.Key)1 MapDataContext (com.intellij.testFramework.MapDataContext)1 Nullable (javax.annotation.Nullable)1