开发者

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;

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜