本文整理汇总了Java中com.intellij.mock.MockProjectEx类的典型用法代码示例。如果您正苦于以下问题:Java MockProjectEx类的具体用法?Java MockProjectEx怎么用?Java MockProjectEx使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MockProjectEx类属于com.intellij.mock包,在下文中一共展示了MockProjectEx类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testConnectDisconnect
import com.intellij.mock.MockProjectEx; //导入依赖的package包/类
@Test
public void testConnectDisconnect() {
Extensions.registerAreaClass("IDEA_PROJECT", null);
MockDisposable mockDisposable = new MockDisposable();
MockApplication application = new MockApplicationEx(mockDisposable);
ApplicationManager.setApplication(application, mockDisposable);
Project project = new MockProjectEx(new MockDisposable());
TestBuckEventHandler handler = new TestBuckEventHandler();
BuckSocket buckSocket = new BuckSocket(handler);
BuckClientManager.getOrCreateClient(project, handler).setBuckSocket(buckSocket);
BuckClientManager.getOrCreateClient(project, handler).connect();
buckSocket.onConnect(new MockSession());
BuckClientManager.getOrCreateClient(project, handler).disconnectWithoutRetry();
buckSocket.onClose(0, "FOO");
assertFalse(BuckClientManager.getOrCreateClient(project, handler).isConnected());
}
示例2: hasBuckDisconnectedThenWeReconnectIfSoSpecified
import com.intellij.mock.MockProjectEx; //导入依赖的package包/类
@Test
public void hasBuckDisconnectedThenWeReconnectIfSoSpecified() {
Extensions.registerAreaClass("IDEA_PROJECT", null);
MockDisposable mockDisposable = new MockDisposable();
MockApplication application = new MockApplicationEx(mockDisposable);
ApplicationManager.setApplication(application, mockDisposable);
Project project = new MockProjectEx(new MockDisposable());
TestBuckEventHandler handler = new TestBuckEventHandler();
BuckSocket buckSocket = new BuckSocket(handler);
BuckClientManager.getOrCreateClient(project, handler).setBuckSocket(buckSocket);
BuckClientManager.getOrCreateClient(project, handler).connect();
buckSocket.onConnect(new MockSession());
BuckClientManager.getOrCreateClient(project, handler).disconnectWithRetry();
buckSocket.onClose(0, "FOO");
buckSocket.onConnect(new MockSession());
assertTrue(BuckClientManager.getOrCreateClient(project, handler).isConnected());
}
示例3: hasBuckModuleAttachReceivedNullTargetThenWeShowNone
import com.intellij.mock.MockProjectEx; //导入依赖的package包/类
@Test
public void hasBuckModuleAttachReceivedNullTargetThenWeShowNone()
throws NoSuchFieldException, IllegalAccessException {
Extensions.registerAreaClass("IDEA_PROJECT", null);
MockDisposable mockDisposable = new MockDisposable();
MockApplication application = new MockApplicationEx(mockDisposable);
ApplicationManager.setApplication(application, mockDisposable);
BuckEventsConsumer buckEventsConsumer =
new BuckEventsConsumer(new MockProjectEx(new MockDisposable()));
buckEventsConsumer.attach(null, new DefaultTreeModel(null));
Field privateStringField = BuckEventsConsumer.class.getDeclaredField("mTarget");
privateStringField.setAccessible(true);
String fieldValue = (String) privateStringField.get(buckEventsConsumer);
assertEquals(fieldValue, "NONE");
}
示例4: initialiseEventsConsumer
import com.intellij.mock.MockProjectEx; //导入依赖的package包/类
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;
}
示例5: initBuckModule
import com.intellij.mock.MockProjectEx; //导入依赖的package包/类
public Project initBuckModule() {
Extensions.registerAreaClass("IDEA_PROJECT", null);
MockDisposable mockDisposable = new MockDisposable();
MockProjectEx project = new MockProjectEx(mockDisposable);
MockApplication application = new MockApplicationEx(mockDisposable);
ApplicationManager.setApplication(application, mockDisposable);
application.registerService(UISettings.class, UISettings.getShadowInstance());
application.registerService(PropertiesComponent.class, new ProjectPropertiesComponentImpl());
FileTypeManager fileTypeManager = EasyMock.createMock(FileTypeManager.class);
EasyMock.expect(
fileTypeManager.getFileTypeByFileName(BuckFileType.INSTANCE.getDefaultExtension()))
.andReturn(BuckFileType.INSTANCE)
.times(3);
EasyMock.replay(fileTypeManager);
application.registerService(FileTypeManager.class, fileTypeManager);
project.addComponent(PsiDocumentManager.class, EasyMock.createMock(PsiDocumentManager.class));
return project;
}
示例6: createTemplateConfiguration
import com.intellij.mock.MockProjectEx; //导入依赖的package包/类
@Test
public void createTemplateConfiguration() {
Extensions.registerAreaClass("IDEA_PROJECT", null);
MockDisposable mockDisposable = new MockDisposable();
MockProject project = new MockProjectEx(mockDisposable);
ConfigurationTypeLivingDoc configurationTypeLivingDoc = new ConfigurationTypeLivingDoc();
RemoteConfigurationFactory remoteConfigurationFactory = new RemoteConfigurationFactory(configurationTypeLivingDoc);
RunConfiguration runConfiguration = remoteConfigurationFactory
.createTemplateConfiguration(project);
Assert.assertNotNull(runConfiguration);
}
示例7: setUp
import com.intellij.mock.MockProjectEx; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
fixture =
IdeaTestFixtureFactory.getFixtureFactory()
.createFixtureBuilder(getTestName(true))
.getFixture();
fixture.setUp();
project = new MockProjectEx(getTestRootDisposable());
PsiManager psiManager = Mockito.mock(PsiManager.class);
project.registerService(PsiManager.class, psiManager);
IntegratedGoogleLoginService mockLoginService =
TestUtils.installMockService(IntegratedGoogleLoginService.class);
GoogleLoginState googleLoginState = Mockito.mock(GoogleLoginState.class);
CredentialedUser user = Mockito.mock(CredentialedUser.class);
LinkedHashMap<String, CredentialedUser> allusers =
new LinkedHashMap<String, CredentialedUser>();
when(user.getEmail()).thenReturn(USER);
when(user.getGoogleLoginState()).thenReturn(googleLoginState);
when(googleLoginState.fetchAccessToken()).thenReturn(PASSWORD);
when(mockLoginService.getAllUsers()).thenReturn(allusers);
allusers.put(USER, user);
}
示例8: testMessages
import com.intellij.mock.MockProjectEx; //导入依赖的package包/类
@Test
public void testMessages() {
Extensions.registerAreaClass("IDEA_PROJECT", null);
MockDisposable mockDisposable = new MockDisposable();
MockApplication application = new MockApplicationEx(mockDisposable);
ApplicationManager.setApplication(application, mockDisposable);
Project project = new MockProjectEx(new MockDisposable());
TestBuckEventHandler handler = new TestBuckEventHandler();
BuckClient client = BuckClientManager.getOrCreateClient(project, handler);
// Set the socket we control
BuckSocket socket = new BuckSocket(handler);
client.setBuckSocket(socket);
client.connect();
assertEquals("", handler.getLastMessage());
socket.onMessage("some text");
assertEquals("some text", handler.getLastMessage());
socket.onMessage("some text 1");
socket.onMessage("some text 2");
socket.onMessage("some text 3");
socket.onMessage("some text 4");
assertEquals("some text 4", handler.getLastMessage());
}
示例9: testReady
import com.intellij.mock.MockProjectEx; //导入依赖的package包/类
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);
}