ssacher-tgm / mockito

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

Introduce deep stubs to help dealing with legacy code #170

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Use it only for legacy code! Be aware of LoD and write simple & easily
testable code! Whenever mock returns a mock, a fairy dies!

Foo mock = mock(Foo.class, RETURNS_DEEP_STUBS);

// note that we're stubbing a chain of methods here: getBar().getName()
when(mock.getBar().getName()).thenReturn("deep");

// note that we're chaining method calls: getBar().getName()
assertEquals("deep", mock.getBar().getName());

Original issue reported on code.google.com by szcze...@gmail.com on 14 Feb 2010 at 9:25

GoogleCodeExporter commented 8 years ago
Thanks James for the patch!

Original comment by szcze...@gmail.com on 14 Feb 2010 at 9:25

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

Original comment by szcze...@gmail.com on 14 Feb 2010 at 9:27

GoogleCodeExporter commented 8 years ago
Issue 149 has been merged into this issue.

Original comment by szcze...@gmail.com on 28 Feb 2010 at 9:03

GoogleCodeExporter commented 8 years ago

Original comment by szcze...@gmail.com on 28 Feb 2010 at 9:04

GoogleCodeExporter commented 8 years ago

Original comment by szcze...@gmail.com on 28 Feb 2010 at 9:05