gordonad / powermock

Automatically exported from code.google.com/p/powermock
0 stars 0 forks source link

Better Mockito support #103

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Make sure that the Mockito support is more complete and similar to the
EasyMock support.

Refactor mock API independent methods such as suppressConstructor to a
common class.

Original issue reported on code.google.com by jan.kron...@gmail.com on 16 May 2009 at 10:44

GoogleCodeExporter commented 9 years ago
Add more Mockito specified tutorial & sample to Wiki.  Currently, I am guessing 
quite 
a bit of how to use Powermock with Mockito.   One example is mocking static 
method. 

PowerMockito.mockStatic(Mocked.class);
// It took me a bit to realize that I need to switch back to use Mockito with 
when()
Mockito.when(Mocked.someMethod(123)).thenReturn("xyz");
....
// verify result is also tricky
PowerMockito.verifyStatic(Mocked.class);
// the parameter values must be mockito matcher to do the verification
Mocked.someMethod(Mockito.eq(123));

Things like that is not trivial(need some thinking...) and might turn some 
people 
away and thought it's not working.  I think this can be addressed simply by 
adding 
couple of wiki page of how to setup behavior and verify result using Mockito 
along 
with Powermock.  I can help if someone can proofread it.

Original comment by szetoj...@gmail.com on 3 Jun 2009 at 7:42

GoogleCodeExporter commented 9 years ago
We would be extremely glad if you could help us out in anyway so you're more 
than
welcome. The reason for the poor Mockito documentation is that we haven't had 
enough
time to produce it and also because the Mockito support is kind of 
experimental. But
for the 1.3 release Mockito is a top priority and any help will be very much 
appreciated.

I find it strange that you need to use Mockito.eq though, I've never needed that
myself and you shouldn't need to I suppose. There are some examples of Mockito 
usage
in our SVN repo. The first thing we probably should do is to link to those 
examples.

Could we please continue this conversation at our mailing list
(powermock@googlegroups.com) instead of here?

Original comment by johan.ha...@gmail.com on 4 Jun 2009 at 8:21

GoogleCodeExporter commented 9 years ago

Original comment by johan.ha...@gmail.com on 19 Sep 2009 at 9:43

GoogleCodeExporter commented 9 years ago
Mockito extension now supports most of the things that the EasyMock extension 
does

Original comment by johan.ha...@gmail.com on 4 Oct 2009 at 10:08