mensahs / mockito

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

Provide JUnit MockitoRule as an alternative to MockitoJUnitRunner #365

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Sometimes it is needed to use a particular Runner, e. g. when using the 
theories framework of JUnit 4 (@RunWith(Theories.class)). To still be able to 
use Mockito in a convenient style, it would be great to have a MockitoRule, so 
automatic mock injection would happen when writing code like this:

@Rule Rule useMockito = new MockitoRule();

Original issue reported on code.google.com by headcrashing on 13 Aug 2012 at 9:58

GoogleCodeExporter commented 8 years ago
Hi, we'll see if that happens, as we had on older JUnit in our classpath, to 
ensure retro-compatibility.

Thx for the idea.

Original comment by brice.du...@gmail.com on 13 Aug 2012 at 12:31

GoogleCodeExporter commented 8 years ago

Original comment by brice.du...@gmail.com on 3 Sep 2012 at 10:00

GoogleCodeExporter commented 8 years ago
@RunWith is broken because you can only have one @RunWith; the @Rule approach 
is better because you can mix multiple Rules into the same test class.

Original comment by m...@thebishops.org on 22 Feb 2013 at 3:41