Index: pkg/analysis_server/test/socket_server_test.dart |
diff --git a/pkg/analysis_server/test/socket_server_test.dart b/pkg/analysis_server/test/socket_server_test.dart |
index 081d5271a68d636e3fa1e67ca1bd67bb4615d019..8b09bfc92cbf3099ec4072c1e73da56d336594a3 100644 |
--- a/pkg/analysis_server/test/socket_server_test.dart |
+++ b/pkg/analysis_server/test/socket_server_test.dart |
@@ -6,42 +6,30 @@ library test.socket.server; |
import 'dart:async'; |
-import 'mocks.dart'; |
- |
import 'package:analysis_server/src/constants.dart'; |
import 'package:analysis_server/src/protocol.dart'; |
import 'package:analysis_server/src/socket_server.dart'; |
import 'package:analyzer/src/generated/sdk_io.dart'; |
import 'package:unittest/unittest.dart'; |
+import 'mocks.dart'; |
+ |
main() { |
group('SocketServer', () { |
- test('createAnalysisServer_successful', |
+ test( |
+ 'createAnalysisServer_successful', |
SocketServerTest.createAnalysisServer_successful); |
- test('createAnalysisServer_alreadyStarted', |
+ test( |
+ 'createAnalysisServer_alreadyStarted', |
SocketServerTest.createAnalysisServer_alreadyStarted); |
test('requestHandler_exception', SocketServerTest.requestHandler_exception); |
- test('requestHandler_futureException', |
+ test( |
+ 'requestHandler_futureException', |
SocketServerTest.requestHandler_futureException); |
}); |
} |
class SocketServerTest { |
- static Future createAnalysisServer_successful() { |
- SocketServer server = new SocketServer(DirectoryBasedDartSdk.defaultSdk); |
- MockServerChannel channel = new MockServerChannel(); |
- server.createAnalysisServer(channel); |
- channel.expectMsgCount(notificationCount: 1); |
- expect(channel.notificationsReceived[0].event, SERVER_CONNECTED); |
- return channel.sendRequest( |
- new ServerShutdownParams().toRequest('0') |
- ).then((Response response) { |
- expect(response.id, equals('0')); |
- expect(response.error, isNull); |
- channel.expectMsgCount(responseCount: 1, notificationCount: 1); |
- }); |
- } |
- |
static void createAnalysisServer_alreadyStarted() { |
SocketServer server = new SocketServer(DirectoryBasedDartSdk.defaultSdk); |
MockServerChannel channel1 = new MockServerChannel(); |
@@ -53,18 +41,34 @@ class SocketServerTest { |
channel2.expectMsgCount(responseCount: 1); |
expect(channel2.responsesReceived[0].id, equals('')); |
expect(channel2.responsesReceived[0].error, isNotNull); |
- expect(channel2.responsesReceived[0].error.code, equals( |
- RequestErrorCode.SERVER_ALREADY_STARTED)); |
- channel2.sendRequest(new ServerShutdownParams().toRequest('0')).then( |
- (Response response) { |
+ expect( |
+ channel2.responsesReceived[0].error.code, |
+ equals(RequestErrorCode.SERVER_ALREADY_STARTED)); |
+ channel2.sendRequest( |
+ new ServerShutdownParams().toRequest('0')).then((Response response) { |
expect(response.id, equals('0')); |
expect(response.error, isNotNull); |
- expect(response.error.code, equals( |
- RequestErrorCode.SERVER_ALREADY_STARTED)); |
+ expect( |
+ response.error.code, |
+ equals(RequestErrorCode.SERVER_ALREADY_STARTED)); |
channel2.expectMsgCount(responseCount: 2); |
}); |
} |
+ static Future createAnalysisServer_successful() { |
+ SocketServer server = new SocketServer(DirectoryBasedDartSdk.defaultSdk); |
+ MockServerChannel channel = new MockServerChannel(); |
+ server.createAnalysisServer(channel); |
+ channel.expectMsgCount(notificationCount: 1); |
+ expect(channel.notificationsReceived[0].event, SERVER_CONNECTED); |
+ return channel.sendRequest( |
+ new ServerShutdownParams().toRequest('0')).then((Response response) { |
+ expect(response.id, equals('0')); |
+ expect(response.error, isNull); |
+ channel.expectMsgCount(responseCount: 1, notificationCount: 1); |
+ }); |
+ } |
+ |
static Future requestHandler_exception() { |
SocketServer server = new SocketServer(DirectoryBasedDartSdk.defaultSdk); |
MockServerChannel channel = new MockServerChannel(); |