concept fake object in category java
appears as: fake objects, fake object, fake object

This is an excerpt from Manning's book Java Testing with Spock.
Spock is a one-stop shop when it comes to testing. It has built-in capabilities for mocking and stubbing (creating fake objects), allowing you to decide on the breadth of the testing context. Spock can test a single class, a code module, or a whole application context with ease. You can perform end-to-end testing with Spock (covered in chapter 7) or isolate one class/method for your testing needs without any external libraries (described in chapter 6).
JUnit doesn’t support mocking (faking external object communication) out of the box. Therefore, I usually employ Mockito[10] when I need to fake objects in my JUnit tests.