infinite / mockito-flex

0 stars 0 forks source link

Multiple called given(something).willReturn(something) always returns first setted value #17

Open infinite opened 10 years ago

infinite commented 10 years ago

Now it is:

var mockedInstance = mock(SomeClass);

given(mockedInstance.method()).willReturn(0); trace(mockedInstance.method()); [trace] 0

given(mockedInstance.method()).willReturn(1); trace(mockedInstance.method()); [trace] 0

given(mockedInstance.method()).willReturn(2); trace(mockedInstance.method()); [trace] 0

Should be:

var mockedInstance = mock(SomeClass);

given(mockedInstance.method()).willReturn(0); trace(mockedInstance.method()); [trace] 0

given(mockedInstance.method()).willReturn(1); trace(mockedInstance.method()); [trace] 1

given(mockedInstance.method()).willReturn(2); trace(mockedInstance.method()); [trace] 2

infinite commented 10 years ago

From Anonymous on 2010-07-08 06:42:04+00:00

This is causing headaches for me. A fix would be appreciated.

infinite commented 10 years ago

From Anonymous on 2011-02-23 13:31:40+00:00

It wouuld be nice if it would behave as Mockito for java does:

when(mock.someMethod("some arg")) .thenReturn(1) .thenReturn(2) .thenReturn(3);

infinite commented 10 years ago

From Anonymous on 2011-04-29 20:56:49+00:00

Please fix that!