Index: pkg/unittest/mock.dart |
diff --git a/pkg/unittest/mock.dart b/pkg/unittest/mock.dart |
index f743d330473f095584375509b7cd92109c25ff11..f0f5765f626e7bea01e9006841fe215957af73a1 100644 |
--- a/pkg/unittest/mock.dart |
+++ b/pkg/unittest/mock.dart |
@@ -1276,10 +1276,17 @@ class Mock { |
* return value. If we find no [Behavior] to apply an exception is |
* thrown. |
*/ |
- noSuchMethod(String method, List args) { |
- if (method.startsWith('get:')) { |
- method = 'get ${method.substring(4)}'; |
+ noSuchMethod(InvocationMirror invocation) { |
+ String method = invocation.memberName; |
+ // Remove this when InvocationMirror works correctly. |
+ if (method.startsWith("get:")) method = method.substring(4); |
+ |
+ if (invocation.isGetter) { |
+ method = 'get $method'; |
} |
+ List args = invocation.positionalArguments; |
+ // TODO: Handle named arguments too. |
+ |
bool matchedMethodName = false; |
MatchState matchState = new MatchState(); |
for (String k in _behaviors.keys) { |