Skip to content

unittest mock: provide way to refer to method calls in a rename friendly manner #15793

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DartBot opened this issue Dec 25, 2013 · 5 comments
Closed
Labels
area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams.

Comments

@DartBot
Copy link

DartBot commented Dec 25, 2013

This issue was originally filed by @Andersmholmgren


The unittest mock library uses strings to represent method calls. e.g.

foo.when(callsTo('fum')).thenReturn(...);

problem is when I want to rename fum then the IDE won't pick up my mocked method calls so I'll have to manually change them.

Issue #13056 would provide a solution. Another option is a mockito style approach which I would imagine could be implemented today using noSuchMethod. e.g.

when(foo.fum()).thenReturn(...);

or

foo.when((f) => foo.fum()).thenReturn(...); // i.e. when calls the function with a second impl of Foo that captures the behaviour. Assuming you can dynamically implement an interface

http://stackoverflow.com/questions/20768280/refactor-friendly-mocking-in-dart

@anders-sandholm
Copy link
Contributor

Added Area-UnitTest, Triaged labels.

@DartBot
Copy link
Author

DartBot commented Feb 8, 2014

This comment was originally written by @Andersmholmgren


Added support for symbol literals for methods in dart-archive/bleeding_edge-DEPRECATED-USE-SDK-INSTEAD#8

@kevmoo
Copy link
Member

kevmoo commented Feb 12, 2014

Removed Area-UnitTest label.
Added Area-Pkg, Pkg-Unittest labels.

@kevmoo
Copy link
Member

kevmoo commented May 9, 2014

Removed Pkg-Unittest label.
Added Pkg-mock label.

@DartBot DartBot added Type-Defect area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams. labels May 9, 2014
@DartBot
Copy link
Author

DartBot commented Jun 4, 2015

This issue has been moved to dart-archive/mock#4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams.
Projects
None yet
Development

No branches or pull requests

3 participants