Chromium Code Reviews| 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 5d6fd715bdbe4e9a5ba2fb37401a10031a1fad8d..282bb558ec30bbb0501ca4eb3c1d107f9f0e9615 100644 |
| --- a/pkg/analysis_server/test/protocol_test.dart |
| +++ b/pkg/analysis_server/test/protocol_test.dart |
| @@ -22,6 +22,8 @@ main() { |
| test('getRequiredParameter_defined', RequestTest.getRequiredParameter_defined); |
| test('getRequiredParameter_undefined', RequestTest.getRequiredParameter_undefined); |
| test('fromJson', RequestTest.fromJson); |
| + test('fromJson_invalidId', RequestTest.fromJson_invalidId); |
| + test('fromJson_invalidMethod', RequestTest.fromJson_invalidMethod); |
| test('fromJson_withParams', RequestTest.fromJson_withParams); |
| test('toJson', RequestTest.toJson); |
| test('toJson_withParams', RequestTest.toJson_withParams); |
| @@ -116,6 +118,18 @@ class RequestTest { |
| expect(request.method, equals('aMethod')); |
| } |
| + static void fromJson_invalidId() { |
| + String json = '{"id":{"one":"two"},"method":"aMethod","params":{"foo":"bar"}}'; |
| + Request request = new Request.fromString(json); |
| + expect(request, isNull); |
| + } |
| + |
| + static void fromJson_invalidMethod() { |
|
Brian Wilkerson
2014/03/05 16:15:16
It would be good to have a test "fromJson_invalidP
danrubel
2014/03/05 18:39:07
Done.
|
| + String json = '{"id":"one","method":{"boo":"aMethod"},"params":{"foo":"bar"}}'; |
| + Request request = new Request.fromString(json); |
| + expect(request, isNull); |
| + } |
| + |
| static void fromJson_withParams() { |
| Request original = new Request('one', 'aMethod'); |
| original.setParameter('foo', 'bar'); |