Closed GoogleCodeExporter closed 9 years ago
I wanted to make this an enhancement, but I couldn't figure out how to do that,
sorry.
Original comment by tie...@gmail.com
on 24 May 2009 at 2:41
What if you considered not using mocks for this case? Are you interested on if
or how
many times setVisible() method is called? Or are you interested in the state of
the
buttons - whether they are visible or not?
assertEquals(false, button1.isVisible());
assertEquals(true, button2.isVisible());
assertEquals(false, button3.isVisible());
Original comment by szcze...@gmail.com
on 24 May 2009 at 10:03
Yes, using Fakes instead of Mocks would make this test as simple as your
suggestion:
assertEquals(false, button1.isVisible());
assertEquals(true, button2.isVisible());
assertEquals(false, button3.isVisible());
In the end, I resorted to this. But, should Mocks settle at being good for some
tests
and Fakes being good at other tests? Wouldn't it be better if Mocks were good
at all
tests? I was suggesting a way that a Mock could be used just as easily as a
Fake for
the type of test it's normally weak at.
Original comment by tie...@gmail.com
on 25 May 2009 at 12:45
>Yes, using Fakes instead of Mocks would make this test as simple as your
suggestion
So what about real objects? Cannot you use real buttons by any chance?
>But, should Mocks settle at being good for some tests
>and Fakes being good at other tests?
I guess my division is: sometimes all the family of mocks is better (spy, mock,
dummy, etc.) and many times real object is better.
Original comment by szcze...@gmail.com
on 25 May 2009 at 7:59
Original comment by szcze...@gmail.com
on 9 Jul 2009 at 12:48
Starting with Mockito 1.8.0 you can use ArgumentCaptor for that:
ArgumentCaptor<Boolean> argument = ArgumentCaptor.forClass(Boolean.class);
verify(button1, atLeast(1)).setVisible(argument.capture());
assertFalse(argument.getValue());
Original comment by bbankow...@gmail.com
on 25 Aug 2009 at 2:02
Original comment by szcze...@gmail.com
on 11 Nov 2009 at 1:33
Original comment by szcze...@gmail.com
on 11 Nov 2009 at 2:35
Original issue reported on code.google.com by
tie...@gmail.com
on 24 May 2009 at 2:41Attachments: