use of com.google.idea.common.experiments.MockExperimentService in project intellij by bazelbuild.
the class BlazeBuildServiceTest method initTest.
@Override
protected void initTest(Container applicationServices, Container projectServices) {
BlazeImportSettingsManager importSettingsManager = new BlazeImportSettingsManager();
importSettingsManager.setImportSettings(new BlazeImportSettings("", "", "", "", Blaze.BuildSystem.Blaze));
projectServices.register(BlazeImportSettingsManager.class, importSettingsManager);
applicationServices.register(ExperimentService.class, new MockExperimentService());
ProjectView view = ProjectView.builder().add(ListSection.builder(TargetSection.KEY).add(TargetExpression.fromStringSafe("//view/target:one")).add(TargetExpression.fromStringSafe("//view/target:two"))).build();
viewSet = ProjectViewSet.builder().add(new File("view/target/.blazeproject"), view).build();
ProjectViewManager viewManager = new MockProjectViewManager(viewSet);
projectServices.register(ProjectViewManager.class, viewManager);
BlazeProjectData blazeProjectData = MockBlazeProjectDataBuilder.builder(workspaceRoot).build();
projectServices.register(BlazeProjectDataManager.class, new MockBlazeProjectDataManager(blazeProjectData));
applicationServices.register(BlazeBuildService.class, spy(new BlazeBuildService()));
service = BlazeBuildService.getInstance();
assertThat(service).isNotNull();
// Can't mock BlazeExecutor.submitTask.
doNothing().when(service).buildTargetExpressions(any(), any(), any(), any());
}
use of com.google.idea.common.experiments.MockExperimentService in project intellij by bazelbuild.
the class BlazeIssueParserTest method initTest.
@Override
protected void initTest(Container applicationServices, Container projectServices) {
super.initTest(applicationServices, projectServices);
applicationServices.register(ExperimentService.class, new MockExperimentService());
projectViewManager = mock(ProjectViewManager.class);
projectServices.register(ProjectViewManager.class, projectViewManager);
ProjectViewSet projectViewSet = ProjectViewSet.builder().add(new File(".blazeproject"), ProjectView.builder().add(ListSection.builder(TargetSection.KEY).add(TargetExpression.fromStringSafe("//tests/com/google/a/b/c/d/baz:baz")).add(TargetExpression.fromStringSafe("//package/path:hello4"))).build()).build();
when(projectViewManager.getProjectViewSet()).thenReturn(projectViewSet);
workspaceRoot = new WorkspaceRoot(new File("/root"));
parsers = ImmutableList.of(new BlazeIssueParser.CompileParser(workspaceRoot), new BlazeIssueParser.TracebackParser(), new BlazeIssueParser.BuildParser(), new BlazeIssueParser.SkylarkErrorParser(), new BlazeIssueParser.LinelessBuildParser(), new BlazeIssueParser.ProjectViewLabelParser(projectViewSet), new BlazeIssueParser.InvalidTargetProjectViewPackageParser(projectViewSet, "no such package '(.*)': BUILD file not found on package path"), new BlazeIssueParser.InvalidTargetProjectViewPackageParser(projectViewSet, "no targets found beneath '(.*)'"), new BlazeIssueParser.InvalidTargetProjectViewPackageParser(projectViewSet, "ERROR: invalid target format '(.*)'"), new BlazeIssueParser.FileNotFoundBuildParser(workspaceRoot), BlazeIssueParser.GenericErrorParser.INSTANCE);
}
use of com.google.idea.common.experiments.MockExperimentService in project intellij by bazelbuild.
the class ProjectViewSetTest method initTest.
@Override
protected void initTest(@NotNull Container applicationServices, @NotNull Container projectServices) {
super.initTest(applicationServices, projectServices);
applicationServices.register(ExperimentService.class, new MockExperimentService());
registerExtensionPoint(BlazeSyncPlugin.EP_NAME, BlazeSyncPlugin.class);
}
use of com.google.idea.common.experiments.MockExperimentService in project intellij by bazelbuild.
the class ProjectViewParserTest method initTest.
@Override
protected void initTest(@NotNull Container applicationServices, @NotNull Container projectServices) {
super.initTest(applicationServices, projectServices);
context = new BlazeContext();
errorCollector = new ErrorCollector();
context.addOutputSink(IssueOutput.class, errorCollector);
projectViewParser = new ProjectViewParser(context, new WorkspacePathResolverImpl(workspaceRoot));
projectViewStorageManager = new MockProjectViewStorageManager();
applicationServices.register(ProjectViewStorageManager.class, projectViewStorageManager);
applicationServices.register(ExperimentService.class, new MockExperimentService());
registerExtensionPoint(BlazeSyncPlugin.EP_NAME, BlazeSyncPlugin.class);
}
use of com.google.idea.common.experiments.MockExperimentService in project intellij by bazelbuild.
the class BlazeSyncManagerTest method initTest.
@Override
protected void initTest(Container applicationServices, Container projectServices) {
super.initTest(applicationServices, projectServices);
MockitoAnnotations.initMocks(this);
applicationServices.register(BlazeUserSettings.class, mock(BlazeUserSettings.class));
applicationServices.register(ExperimentService.class, new MockExperimentService());
doNothing().when(manager).requestProjectSync(any());
projectServices.register(BlazeSyncManager.class, manager);
assertThat(BlazeSyncManager.getInstance(project)).isSameAs(manager);
}
Aggregations