| Index: pkg/analysis_server/test/protocol_test.dart
|
| diff --git a/pkg/analysis_server/test/protocol_test.dart b/pkg/analysis_server/test/protocol_test.dart
|
| index 9e6036b74c1f7256ac7793f89145d3607d490ad4..8813a686e4dedc53bba83ca39ac3adfba261ee76 100644
|
| --- a/pkg/analysis_server/test/protocol_test.dart
|
| +++ b/pkg/analysis_server/test/protocol_test.dart
|
| @@ -9,6 +9,7 @@ import 'dart:convert';
|
| import 'package:analysis_server/src/protocol.dart';
|
| import 'package:analysis_testing/reflective_tests.dart';
|
| import 'package:unittest/unittest.dart';
|
| +import 'package:analysis_server/src/collections.dart';
|
|
|
|
|
| Matcher _throwsRequestFailure = throwsA(new isInstanceOf<RequestFailure>());
|
| @@ -105,6 +106,40 @@ class NotificationTest {
|
| 'event': 'foo'
|
| }));
|
| }
|
| +
|
| + void test_setParameter_HasToJson() {
|
| + Notification notification = new Notification('foo');
|
| + notification.setParameter('my', new _MyHasToJsonObject(42));
|
| + expect(notification.toJson(), equals({
|
| + 'event': 'foo',
|
| + 'params': {
|
| + 'my': {
|
| + 'offset': 42
|
| + }
|
| + }
|
| + }));
|
| + }
|
| +
|
| + void test_setParameter_Iterable_HasToJson() {
|
| + Notification notification = new Notification('foo');
|
| + notification.setParameter('my', [
|
| + new _MyHasToJsonObject(1),
|
| + new _MyHasToJsonObject(2),
|
| + new _MyHasToJsonObject(3)]);
|
| + expect(notification.toJson(), equals({
|
| + 'event': 'foo',
|
| + 'params': {
|
| + 'my': [{'offset': 1}, {'offset': 2}, {'offset': 3}]
|
| + }
|
| + }));
|
| + }
|
| +}
|
| +
|
| +
|
| +class _MyHasToJsonObject implements HasToJson {
|
| + int offset;
|
| + _MyHasToJsonObject(this.offset);
|
| + Map<String, Object> toJson() => {'offset': offset};
|
| }
|
|
|
|
|
|
|