Chromium Code Reviews| Index: pkg/oauth2/test/client_test.dart |
| diff --git a/pkg/oauth2/test/client_test.dart b/pkg/oauth2/test/client_test.dart |
| index bac05485457a3c55b4bed23877db0598bb093336..7a05e9905a7faedce8fb64a5513ac8c88df11abb 100644 |
| --- a/pkg/oauth2/test/client_test.dart |
| +++ b/pkg/oauth2/test/client_test.dart |
| @@ -25,12 +25,6 @@ void createHttpClient() { |
| httpClient = new ExpectClient(); |
| } |
| -void expectFutureThrows(future, predicate) { |
| - future.catchError(expectAsync1((error) { |
| - expect(predicate(error), isTrue); |
| - })); |
| -} |
| - |
| void main() { |
| group('with expired credentials', () { |
| setUp(createHttpClient); |
| @@ -42,8 +36,8 @@ void main() { |
| var client = new oauth2.Client('identifier', 'secret', credentials, |
| httpClient: httpClient); |
| - expectFutureThrows(client.get(requestUri), |
| - (e) => e is oauth2.ExpirationException); |
| + expect(client.get(requestUri), |
| + throwsA(new isInstanceOf<oauth2.ExpirationException>())); |
| }); |
| test("that can be refreshed refreshes the credentials and sends the " |
| @@ -123,8 +117,7 @@ void main() { |
| var client = new oauth2.Client('identifier', 'secret', credentials, |
| httpClient: httpClient); |
| - expectFutureThrows(client.refreshCredentials(), |
| - (e) => e is StateError); |
| + expect(client.refreshCredentials(), throwsA(isStateError)); |
|
Bob Nystrom
2013/04/30 21:56:54
You can use throwsStateError.
|
| }); |
| }); |
| @@ -148,8 +141,8 @@ void main() { |
| headers: {'www-authenticate': authenticate})); |
| }); |
| - expectFutureThrows(client.read(requestUri), |
| - (e) => e is oauth2.AuthorizationException); |
| + expect(client.read(requestUri), |
| + throwsA(new isInstanceOf<oauth2.AuthorizationException>())); |
| }); |
| test('passes through a 401 response without www-authenticate', () { |