Only unstubbed properties exhibit this bug. Methods and stubbed properties can be retrieved as expected.
The failing unit test will throw "Error #1065: Variable AS3vec::Vector. is not defined."
public class PartialMockVectorError
{
[Rule]
public var mocks:MockolateRule = new MockolateRule();
[Mock(type="partial")]
public var vectorWrapper:ClassWithVector;
[Test]
public function testShouldGetVector():void
{
//fails
vectorWrapper.someList;
}
[Test]
public function testStubbedPropertyShouldGetVector():void
{
//passes
var vector:Vector.<String> = new Vector.<String>();
stub(vectorWrapper).getter("someList").returns(vector);
assertTrue(vectorWrapper.someList === vector);
}
[Test]
public function testMethodShouldGetVector():void
{
//passes
vectorWrapper.retrieveSomeList();
}
}
public class ClassWithVector
{
private var _someList:Vector.<String>;
public function ClassWithVector():void
{
_someList = new Vector.<String>();
}
public function get someList():Vector.<String>
{
return _someList;
}
public function set someList(value:Vector.<String>):void
{
_someList = value;
}
public function retrieveSomeList():Vector.<String>
{
return _someList;
}
}
Only unstubbed properties exhibit this bug. Methods and stubbed properties can be retrieved as expected.
The failing unit test will throw "Error #1065: Variable AS3vec::Vector. is not defined."