ssacher-tgm / mockito

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

Relax the internal validation checks to allow inlined mock creation in stubbing #191

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Relax the internal validation checks to allow inlined mock creation in stubbing

Original issue reported on code.google.com by szcze...@gmail.com on 24 May 2010 at 8:00

GoogleCodeExporter commented 8 years ago
Allow both options #1 and #2. Previously, only option #2 was permitted due to 
validation checks.

//1
when(mock.foo()).thenReturn(mock(Foo.class));

//2
Foo foo = mock(Foo.class);
when(mock.foo()).thenReturn(foo);

Original comment by szcze...@gmail.com on 31 Oct 2010 at 8:30

GoogleCodeExporter commented 8 years ago
BTW. it's a well known code smell when mocks return mocks so don't get too 
excited about this feature :)

Original comment by szcze...@gmail.com on 31 Oct 2010 at 8:53

GoogleCodeExporter commented 8 years ago
This issue was closed by revision 590e8eb051.

Original comment by szcze...@gmail.com on 31 Oct 2010 at 8:55

GoogleCodeExporter commented 8 years ago

Original comment by szcze...@gmail.com on 3 Jul 2011 at 12:43