I have used the dart unittest framework and the included Mock class as described
There is however a dependency in the mock calls i.e:
..store.when(callsTo('isLocked')).thenReturn(false);
where the call to the isLocked
method is called by name. If someone renamed the isLocked
method the refactoring framework will not rename the call.
I was wondering if reflection (mirrors) could help somehow, but I haven't found a solution.
Cheers Peter
Well, the method I ended up using is a constant class with method names. Like so:
class MethodNames{
final String GET_ELEMENT = 'getElement';
final String GET_CLASSES = 'get classes';
final String SET_DISABLED = 'set:disabled';
final String AS_INPUT = 'asInput';
final String AS_BUTTON = 'asButton';
final String SET_INNER_HTML = 'set:innerHTML';
final String SET_VALUE = 'set:value';
...
const MethodNames();
}
I has the advantage of being nice and simple. I tend to prefer that.
cheers Peter