use of com.intellij.mock.MockProject in project buck by facebook.
the class BuckEventsConsumerTest method initialiseEventsConsumer.
public BuckEventsConsumer initialiseEventsConsumer() {
Extensions.registerAreaClass("IDEA_PROJECT", null);
MockDisposable mockDisposable = new MockDisposable();
MockProject project = new MockProjectEx(new MockDisposable());
MockApplication application = new MyMockApplication(mockDisposable);
ApplicationManager.setApplication(application, mockDisposable);
final BuckEventsConsumer buckEventsConsumer = new BuckEventsConsumer(project);
project.registerService(BuckUIManager.class, new BuckUIManager());
project.registerService(ToolWindowManager.class, new Mock.MyToolWindowManager());
application.registerService(FileDocumentManager.class, new MockFileDocumentManagerImpl(null, null));
application.registerService(VirtualFileManager.class, EasyMock.createMock(VirtualFileManager.class));
return buckEventsConsumer;
}
use of com.intellij.mock.MockProject in project intellij-community by JetBrains.
the class ActivityMonitorTest method testReady.
public void testReady() {
assertReady(null);
MockProject project1 = new MockProjectEx(getTestRootDisposable());
assertReady(project1);
MockProject project2 = new MockProjectEx(getTestRootDisposable());
assertReady(project2);
myMonitor.initBusyObjectFor(project1);
assertTrue(myMonitor.hasObjectFor(project1));
myMonitor.initBusyObjectFor(project2);
assertTrue(myMonitor.hasObjectFor(project2));
myMonitor.addActivity(new UiActivity("global"), ModalityState.any());
assertBusy(null);
assertBusy(project1);
assertBusy(project2);
myMonitor.addActivity(new UiActivity("global"), ModalityState.any());
assertBusy(null);
assertBusy(project1);
assertBusy(project2);
myMonitor.removeActivity(new UiActivity("global"));
assertReady(null);
assertReady(project1);
assertReady(project2);
myMonitor.addActivity(project1, new UiActivity("p1"), ModalityState.any());
assertReady(null);
assertBusy(project1);
assertReady(project2);
myMonitor.addActivity(new UiActivity("global"), ModalityState.any());
assertBusy(null);
assertBusy(project1);
assertBusy(project2);
myMonitor.removeActivity(new UiActivity("global"));
assertReady(null);
assertBusy(project1);
assertReady(project2);
myMonitor.removeActivity(project1, new UiActivity("p1"));
assertReady(null);
assertReady(project1);
assertReady(project2);
}
use of com.intellij.mock.MockProject in project intellij by bazelbuild.
the class BlazeTestCase method setup.
@Before
public final void setup() {
testDisposable = new RootDisposable();
TestUtils.createMockApplication(testDisposable);
MutablePicoContainer applicationContainer = (MutablePicoContainer) ApplicationManager.getApplication().getPicoContainer();
MockProject mockProject = TestUtils.mockProject(applicationContainer, testDisposable);
Extensions.cleanRootArea(testDisposable);
extensionsArea = (ExtensionsAreaImpl) Extensions.getRootArea();
this.project = mockProject;
initTest(new Container(applicationContainer), new Container(mockProject.getPicoContainer()));
}
Aggregations