Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Side by Side Diff: pkg/json_rpc_2/test/server/utils.dart

Issue 205533005: Create a package that implements a JSON-RPC 2.0 server. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library json_rpc_2.test.server.util;
6
7 import 'package:unittest/unittest.dart';
8 import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc;
9
10 void expectErrorResponse(json_rpc.Server server, request, int errorCode,
11 String message) {
12 var id;
13 if (request is Map) id = request['id'];
14
15 expect(server.handleRequest(request), completion(equals({
16 'jsonrpc': '2.0',
17 'id': id,
18 'error': {
19 'code': errorCode,
20 'message': message,
21 'data': {'request': request}
22 }
23 })));
24 }
25
26 Matcher throwsInvalidParams(String message) {
27 return throwsA(predicate((error) {
28 expect(error, new isInstanceOf<json_rpc.RpcException>());
29 expect(error.message, equals(message));
30 return true;
31 }));
32 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698