OLD | NEW |
(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 error_matchers; |
| 6 |
| 7 import 'package:unittest/unittest.dart'; |
| 8 import 'package:gcloud/datastore.dart'; |
| 9 |
| 10 class _ApplicationError extends TypeMatcher { |
| 11 const _ApplicationError() : super("ApplicationError"); |
| 12 bool matches(item, Map matchState) => item is ApplicationError; |
| 13 } |
| 14 |
| 15 |
| 16 class _DataStoreError extends TypeMatcher { |
| 17 const _DataStoreError() : super("DataStoreError"); |
| 18 bool matches(item, Map matchState) => item is DatastoreError; |
| 19 } |
| 20 |
| 21 class _TransactionAbortedError extends TypeMatcher { |
| 22 const _TransactionAbortedError() : super("TransactionAbortedError"); |
| 23 bool matches(item, Map matchState) => item is TransactionAbortedError; |
| 24 } |
| 25 |
| 26 class _NeedIndexError extends TypeMatcher { |
| 27 const _NeedIndexError() : super("NeedIndexError"); |
| 28 bool matches(item, Map matchState) => item is NeedIndexError; |
| 29 } |
| 30 |
| 31 class _TimeoutError extends TypeMatcher { |
| 32 const _TimeoutError() : super("TimeoutError"); |
| 33 bool matches(item, Map matchState) => item is TimeoutError; |
| 34 } |
| 35 |
| 36 |
| 37 class _IntMatcher extends TypeMatcher { |
| 38 const _IntMatcher() : super("IntMatcher"); |
| 39 bool matches(item, Map matchState) => item is int; |
| 40 } |
| 41 |
| 42 const isApplicationError = const _ApplicationError(); |
| 43 |
| 44 const isDataStoreError = const _DataStoreError(); |
| 45 const isTransactionAbortedError = const _TransactionAbortedError(); |
| 46 const isNeedIndexError = const _NeedIndexError(); |
| 47 const isTimeoutError = const _TimeoutError(); |
| 48 |
| 49 const isInt = const _IntMatcher(); |
OLD | NEW |