本文整理汇总了Java中com.intellij.mock.MockApplication类的典型用法代码示例。如果您正苦于以下问题:Java MockApplication类的具体用法?Java MockApplication怎么用?Java MockApplication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MockApplication类属于com.intellij.mock包,在下文中一共展示了MockApplication类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: reportTestExecutionStatistics
import com.intellij.mock.MockApplication; //导入依赖的package包/类
@SuppressWarnings("UseOfSystemOutOrSystemErr")
public static void reportTestExecutionStatistics() {
System.out.println("----- TEST STATISTICS -----");
UsefulTestCase.logSetupTeardownCosts();
System.out.println(String.format("##teamcity[buildStatisticValue key='ideaTests.appInstancesCreated' value='%d']",
MockApplication.INSTANCES_CREATED));
System.out.println(String.format("##teamcity[buildStatisticValue key='ideaTests.projectInstancesCreated' value='%d']",
ProjectManagerImpl.TEST_PROJECTS_CREATED));
long totalGcTime = 0;
for (GarbageCollectorMXBean mxBean : ManagementFactory.getGarbageCollectorMXBeans()) {
totalGcTime += mxBean.getCollectionTime();
}
System.out.println(String.format("##teamcity[buildStatisticValue key='ideaTests.gcTimeMs' value='%d']", totalGcTime));
System.out.println(String.format("##teamcity[buildStatisticValue key='ideaTests.classesLoaded' value='%d']",
ManagementFactory.getClassLoadingMXBean().getTotalLoadedClassCount()));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:LightPlatformTestCase.java
示例2: setUp
import com.intellij.mock.MockApplication; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
Disposable parentDisposable = new Disposable() {
@Override
public void dispose() {
}
};
MockApplication mockApplication = new MockApplication(parentDisposable);
mockApplication.addComponent(VirtualFileManager.class, mockVirtualFileManager);
ApplicationManager.setApplication(mockApplication, parentDisposable);
mockProject.addComponent(PsiManager.class, mockPsiManager);
mockProject.setBasePath(getClass().getClassLoader().getResource(".").getPath());
}
开发者ID:HotelsDotCom,项目名称:shared-views,代码行数:17,代码来源:SharedViewGroupNodeTest.java
示例3: setUp
import com.intellij.mock.MockApplication; //导入依赖的package包/类
@Before
public void setUp() {
MockApplication application = new MyMockApplicationEx(parent);
ActionManagerEx manager = Mockito.mock(ActionManagerEx.class);
ActionToolbar actionToolbar = Mockito.mock(ActionToolbar.class);
Mockito.when(actionToolbar.getComponent()).thenReturn(new JComponent() {});
Mockito.when(
manager.createActionToolbar(
Mockito.anyString(), Mockito.any(ActionGroup.class), Mockito.anyBoolean()))
.thenReturn(actionToolbar);
Mockito.when(
manager.createActionToolbar(
Mockito.anyString(),
Mockito.any(ActionGroup.class),
Mockito.anyBoolean(),
Mockito.anyBoolean()))
.thenReturn(actionToolbar);
application.addComponent(ActionManager.class, manager);
application.registerService(UISettings.class);
ApplicationManager.setApplication(application, parent);
XDebugSession session = Mockito.mock(XDebugSession.class);
Mockito.when(handler.getProcess()).thenReturn(mockProcess);
Mockito.when(mockProcess.getXDebugSession()).thenReturn(session);
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:26,代码来源:CloudDebugHistoricalSnapshotsTest.java
示例4: setUp
import com.intellij.mock.MockApplication; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
myCurrentState = ModalityState.NON_MODAL;
final ModalityStateEx any = new ModalityStateEx();
Extensions.registerAreaClass("IDEA_PROJECT", null);
ApplicationManager.setApplication(new MockApplication(getTestRootDisposable()) {
@NotNull
@Override
public ModalityState getCurrentModalityState() {
return myCurrentState;
}
@Override
public ModalityState getAnyModalityState() {
return any;
}
}, getTestRootDisposable());
myMonitor = new UiActivityMonitorImpl();
myMonitor.setActive(true);
disposeOnTearDown(myMonitor);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:ActivityMonitorTest.java
示例5: testConnectDisconnect
import com.intellij.mock.MockApplication; //导入依赖的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());
}
开发者ID:facebook,项目名称:buck,代码行数:23,代码来源:BuckClientTest.java
示例6: hasBuckDisconnectedThenWeReconnectIfSoSpecified
import com.intellij.mock.MockApplication; //导入依赖的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());
}
开发者ID:facebook,项目名称:buck,代码行数:24,代码来源:BuckClientTest.java
示例7: hasBuckModuleAttachReceivedNullTargetThenWeShowNone
import com.intellij.mock.MockApplication; //导入依赖的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");
}
开发者ID:facebook,项目名称:buck,代码行数:22,代码来源:BuckEventsConsumerTest.java
示例8: initialiseEventsConsumer
import com.intellij.mock.MockApplication; //导入依赖的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;
}
开发者ID:facebook,项目名称:buck,代码行数:20,代码来源:BuckEventsConsumerTest.java
示例9: initBuckModule
import com.intellij.mock.MockApplication; //导入依赖的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;
}
开发者ID:facebook,项目名称:buck,代码行数:21,代码来源:BuckModuleTest.java
示例10: checkForSettingsDamage
import com.intellij.mock.MockApplication; //导入依赖的package包/类
protected void checkForSettingsDamage(@NotNull List<Throwable> exceptions) {
Application app = ApplicationManager.getApplication();
if (isPerformanceTest() || app == null || app instanceof MockApplication) {
return;
}
CodeStyleSettings oldCodeStyleSettings = myOldCodeStyleSettings;
if (oldCodeStyleSettings == null) {
return;
}
myOldCodeStyleSettings = null;
doCheckForSettingsDamage(oldCodeStyleSettings, getCurrentCodeStyleSettings(), exceptions);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:UsefulTestCase.java
示例11: setUp
import com.intellij.mock.MockApplication; //导入依赖的package包/类
public void setUp() {
final Application application = ApplicationManager.getApplication();
if (application == null) {
myAppDisposable = Disposer.newDisposable();
ApplicationManager.setApplication(new MockApplication(myAppDisposable), myAppDisposable);
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:8,代码来源:PlatformUltraLiteTestFixture.java
示例12: checkForSettingsDamage
import com.intellij.mock.MockApplication; //导入依赖的package包/类
protected void checkForSettingsDamage() throws Exception {
if (isPerformanceTest() || ApplicationManager.getApplication() == null || ApplicationManager.getApplication() instanceof MockApplication) {
return;
}
CodeStyleSettings oldCodeStyleSettings = myOldCodeStyleSettings;
myOldCodeStyleSettings = null;
doCheckForSettingsDamage(oldCodeStyleSettings, getCurrentCodeStyleSettings());
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:UsefulTestCase.java
示例13: testMessages
import com.intellij.mock.MockApplication; //导入依赖的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());
}
开发者ID:facebook,项目名称:buck,代码行数:31,代码来源:BuckClientTest.java
示例14: setUp
import com.intellij.mock.MockApplication; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
Disposable disposable = mock(Disposable.class);
ApplicationManager.setApplication(new MockApplication(disposable), disposable);
}
开发者ID:TNG,项目名称:jgiven-intellij-plugin,代码行数:6,代码来源:ReferenceProviderTest.java
示例15: createApplication
import com.intellij.mock.MockApplication; //导入依赖的package包/类
@NotNull
protected MockApplication createApplication(@NotNull Disposable parentDisposable) {
return new MockApplicationEx(parentDisposable);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:CoreApplicationEnvironment.java
示例16: getApplication
import com.intellij.mock.MockApplication; //导入依赖的package包/类
@NotNull
public MockApplication getApplication() {
return myApplication;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:CoreApplicationEnvironment.java
示例17: createApplication
import com.intellij.mock.MockApplication; //导入依赖的package包/类
protected MockApplication createApplication(Disposable parentDisposable) {
return new MockApplication(parentDisposable);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:4,代码来源:CoreApplicationEnvironment.java
示例18: getApplication
import com.intellij.mock.MockApplication; //导入依赖的package包/类
public MockApplication getApplication() {
return myApplication;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:4,代码来源:CoreApplicationEnvironment.java
示例19: createApplication
import com.intellij.mock.MockApplication; //导入依赖的package包/类
@Nonnull
protected MockApplication createApplication(@Nonnull Disposable parentDisposable) {
return new MockApplicationEx(parentDisposable);
}
开发者ID:consulo,项目名称:consulo,代码行数:5,代码来源:CoreApplicationEnvironment.java
示例20: getApplication
import com.intellij.mock.MockApplication; //导入依赖的package包/类
@Nonnull
public MockApplication getApplication() {
return myApplication;
}
开发者ID:consulo,项目名称:consulo,代码行数:5,代码来源:CoreApplicationEnvironment.java
注:本文中的com.intellij.mock.MockApplication类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论