While unit testing in actionscript-3 with mockolate I have run into quite a few problems/errors:

Error: No Expectation defined for Invocation:[FloxyInvocation invocationType=GETTER name="propertyName" arguments=[]]

Error: 1 unmet Expectation

Mockolate errors and debugging are poorly documented and searches bring up no results, so solving these problems get very tricky.

有帮助吗?

解决方案

No expectation defined error is thrown when the function you are testing expects the specified invocation type and name:

  Error: No Expectation defined for Invocation:[FloxyInvocation invocationType=GETTER name="propertyName" arguments=[]]

Can be solved with:

mock(object).getter("propertyName").returns(someValue);

Unmet expectation error can be thrown when you created a mock statement (a getter or setter) but there is no getter or setter defined for the variable you are getting or setting.

Error: 1 unmet Expectation

Can be solved with:

    public function get variable():String {
        return _variable;
    }

    public function set variable(value:String):void {
        _variable = value;
    }
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top