Open DartBot opened 9 years ago
This comment was originally written by cvl.chi...@gmail.com
This is a workaround for this case:
class TaskMock implements Task { Mock mock = new Mock(); noSuchMethod(Invocation invocation) { return mock.noSuchMethod(invocation); } }
Then in testing: var task = new TaskMock(); task.mock.when(callsTo('get name')).alwaysReturn('test');
Comment by sethladd
Removed Type-Defect label. Added Type-Enhancement, Area-Pkg, Pkg-Mocks, Triaged labels.
Originally opened as dart-lang/sdk#15172
This issue was originally filed by cvl.c...@gmail.com
Hi!
It is not possible to mock this:
var task = new TaskMock(); task.when(callsTo('get name')).alwaysReturn('test'); print(task.name);
-> prints null.
It conflicts with the internal "Mock" name attribute.
Guess there will be similar problems with the other defined methods and attributes in the Mock class.