开发者

Can getters and setters be mocked using mockito-flex?

开发者 https://www.devze.com 2023-01-30 03:40 出处:网络
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-fi

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

精彩评论

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