use of com.intellij.mock.MockApplication in project buck by facebook.
the class BuckClientTest method testConnectDisconnect.
@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());
}
use of com.intellij.mock.MockApplication in project intellij-community by JetBrains.
the class UsefulTestCase method checkForSettingsDamage.
protected void checkForSettingsDamage() {
Application app = ApplicationManager.getApplication();
if (isStressTest() || app == null || app instanceof MockApplication) {
return;
}
CodeStyleSettings oldCodeStyleSettings = myOldCodeStyleSettings;
if (oldCodeStyleSettings == null) {
return;
}
myOldCodeStyleSettings = null;
doCheckForSettingsDamage(oldCodeStyleSettings, getCurrentCodeStyleSettings());
}
Aggregations