OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * A simple mocking/spy library. | 6 * A simple mocking/spy library. |
7 * | 7 * |
8 * ## Installing ## | 8 * ## Installing ## |
9 * | 9 * |
10 * Use [pub][] to install this package. Add the following to your `pubspec.yaml` | 10 * Use [pub][] to install this package. Add the following to your `pubspec.yaml` |
(...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1237 *[neverThrew] asserts that no matching call to a method threw | 1237 *[neverThrew] asserts that no matching call to a method threw |
1238 * a value that matched [value]. | 1238 * a value that matched [value]. |
1239 */ | 1239 */ |
1240 Matcher neverThrew(value) => | 1240 Matcher neverThrew(value) => |
1241 new _ResultSetMatcher(Action.THROW, wrapMatcher(value), _Frequency.NONE); | 1241 new _ResultSetMatcher(Action.THROW, wrapMatcher(value), _Frequency.NONE); |
1242 | 1242 |
1243 /** The shared log used for named mocks. */ | 1243 /** The shared log used for named mocks. */ |
1244 LogEntryList sharedLog = null; | 1244 LogEntryList sharedLog = null; |
1245 | 1245 |
1246 /** The base class for all mocked objects. */ | 1246 /** The base class for all mocked objects. */ |
| 1247 @proxy |
1247 class Mock { | 1248 class Mock { |
1248 /** The mock name. Needed if the log is shared; optional otherwise. */ | 1249 /** The mock name. Needed if the log is shared; optional otherwise. */ |
1249 final String name; | 1250 final String name; |
1250 | 1251 |
1251 /** The set of [Behavior]s supported. */ | 1252 /** The set of [Behavior]s supported. */ |
1252 LinkedHashMap<String,Behavior> _behaviors; | 1253 LinkedHashMap<String,Behavior> _behaviors; |
1253 | 1254 |
1254 /** The [log] of calls made. Only used if [name] is null. */ | 1255 /** The [log] of calls made. Only used if [name] is null. */ |
1255 LogEntryList log; | 1256 LogEntryList log; |
1256 | 1257 |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1538 } | 1539 } |
1539 } | 1540 } |
1540 } | 1541 } |
1541 | 1542 |
1542 /** Clear both logs and behavior. */ | 1543 /** Clear both logs and behavior. */ |
1543 void reset() { | 1544 void reset() { |
1544 resetBehavior(); | 1545 resetBehavior(); |
1545 clearLogs(); | 1546 clearLogs(); |
1546 } | 1547 } |
1547 } | 1548 } |
OLD | NEW |