I'm using mockito-1.3 RC3 in Flex Builder 3 with FlexUnit 4. Sorry, I
guess that would help!
Here's a simple example of the kind of test I have set up...
import org.flexunit.assertThat;
import org.hamcrest.object.equalTo;
import org.mockito.integrations.flexunit4.MockitoClassRunner;
import org.mockito.integrations.given;
[RunWith("org.mockito.integrations.flexunit4.MockitoClassRunner")]
public class MockObjectTest
{
[Mock(type="test.com.adobe.ac.i3.km.mockito.MockObject")]
public var obj:MockObject;
[Test]
public function testReturnTrueAsFalse():void
{
given(obj.returnTrue()).willReturn(false);
assertThat(obj.returnTrue(), equalTo(false));
}
[Test]
public function testAbcAsXyz():void
{
given(obj.abc).willReturn("xyz");
assertThat(obj.abc, equalTo("xyz"));
}
}
I just saw an older post about an error "Please make sure you
specified a call to stub in given(...)" which are most of the errors I
get. I also get null reference errors, which I believe are a result
of the failure to mock whatever object is noted with [Mock]. I'm
currently attempting to compile and run with RC5 to see if that fixes
it. Do you know if there were any known issues fixed in more recent
releases?