Search in sources :

Example 6 with MockModule

use of com.intellij.mock.MockModule in project intellij by bazelbuild.

the class BlazeBuildSystemServiceTest method initTest.

@Override
protected void initTest(Container applicationServices, Container projectServices) {
    module = new MockModule(project, () -> {
    });
    // For Blaze.isBlazeProject.
    mockBlazeImportSettings(projectServices);
    createMocksForBuildProject(applicationServices);
    createMocksForSyncProject(projectServices);
    createMocksForAddDependency(applicationServices, projectServices);
    ExtensionPoint<BuildSystemService> extensionPoint = registerExtensionPoint(ExtensionPointName.create("com.android.project.buildSystemService"), BuildSystemService.class);
    extensionPoint.registerExtension(new BlazeBuildSystemService());
    service = BuildSystemService.getInstance(project);
}
Also used : BuildSystemService(com.android.tools.idea.project.BuildSystemService) MockModule(com.intellij.mock.MockModule)

Example 7 with MockModule

use of com.intellij.mock.MockModule in project intellij by bazelbuild.

the class BlazeAndroidModelTest method initTest.

@Override
protected void initTest(Container applicationServices, Container projectServices) {
    applicationServices.register(FileTypeManager.class, new MockFileTypeManager());
    applicationServices.register(FileDocumentManager.class, new MockFileDocumentManagerImpl(null, null));
    applicationServices.register(VirtualFileManager.class, mock(VirtualFileManager.class));
    applicationServices.register(BlazeBuildService.class, new BlazeBuildService());
    projectServices.register(ProjectScopeBuilder.class, new ProjectScopeBuilderImpl(project));
    projectServices.register(ProjectViewManager.class, new MockProjectViewManager());
    projectServices.register(BlazeProjectDataManager.class, new BlazeProjectDataManagerImpl(project));
    BlazeImportSettingsManager manager = new BlazeImportSettingsManager();
    manager.setImportSettings(new BlazeImportSettings("", "", "", "", BuildSystem.Blaze));
    projectServices.register(BlazeImportSettingsManager.class, manager);
    facade = new MockJavaPsiFacade(project, new MockPsiManager(project), ImmutableList.of("com.google.example.Modified", "com.google.example.NotModified"));
    projectServices.register(JavaPsiFacade.class, facade);
    module = new MockModule(() -> {
    });
    model = new BlazeAndroidModel(project, module, null, mock(SourceProvider.class), null, "", 0);
}
Also used : BlazeImportSettingsManager(com.google.idea.blaze.base.settings.BlazeImportSettingsManager) MockFileDocumentManagerImpl(com.intellij.mock.MockFileDocumentManagerImpl) BlazeImportSettings(com.google.idea.blaze.base.settings.BlazeImportSettings) VirtualFileManager(com.intellij.openapi.vfs.VirtualFileManager) BlazeProjectDataManagerImpl(com.google.idea.blaze.base.sync.data.BlazeProjectDataManagerImpl) MockFileTypeManager(com.intellij.openapi.fileTypes.MockFileTypeManager) MockPsiManager(com.intellij.mock.MockPsiManager) MockModule(com.intellij.mock.MockModule) BlazeBuildService(com.google.idea.blaze.base.actions.BlazeBuildService) ProjectScopeBuilderImpl(com.intellij.psi.search.ProjectScopeBuilderImpl)

Aggregations

MockModule (com.intellij.mock.MockModule)7 Module (com.intellij.openapi.module.Module)3 BlazeImportSettings (com.google.idea.blaze.base.settings.BlazeImportSettings)2 BlazeImportSettingsManager (com.google.idea.blaze.base.settings.BlazeImportSettingsManager)2 Result (com.intellij.openapi.application.Result)2 WriteCommandAction (com.intellij.openapi.command.WriteCommandAction)2 MockFileTypeManager (com.intellij.openapi.fileTypes.MockFileTypeManager)2 ProjectScopeBuilderImpl (com.intellij.psi.search.ProjectScopeBuilderImpl)2 Result (com.android.ide.common.rendering.api.Result)1 ViewInfo (com.android.ide.common.rendering.api.ViewInfo)1 UsageTracker (com.android.tools.analytics.UsageTracker)1 Configuration (com.android.tools.idea.configurations.Configuration)1 BuildSystemService (com.android.tools.idea.project.BuildSystemService)1 HtmlLinkManager (com.android.tools.idea.rendering.HtmlLinkManager)1 RenderErrorContributor (com.android.tools.idea.rendering.RenderErrorContributor)1 RenderLogger (com.android.tools.idea.rendering.RenderLogger)1 RenderResult (com.android.tools.idea.rendering.RenderResult)1 DesignSurface (com.android.tools.idea.uibuilder.surface.DesignSurface)1 AndroidResourceModuleRegistry (com.google.idea.blaze.android.sync.model.AndroidResourceModuleRegistry)1 BlazeBuildService (com.google.idea.blaze.base.actions.BlazeBuildService)1