Can getters and setters be mocked using mockito-flex?
Nee开发者_运维技巧d to know if Mockito-flex supports mocking getters and setters. Thanks.
Yes. Getters and setters can be mocked as long as the class being mocked and the getter/setter methods are non-final.
Yes. Here's an example:
_mockFixedList = mock(IFixedList);
var len:int = 10;
given(_mockFixedList.length).willReturn(len);
Where IFixedList has
function get length():int;
Then
trace('len=' + len);
will trace 'len='+10;
精彩评论