That trick is about using Spring Framework and Mockito to build integration tests and mock behaviours of the dependencies. The mocks are not data mocks but dependency mocks. Data mocks are a little bit different than dependency mocking as the previous one allows generating/injecting data for the mock on the wire, while the latter one mocks library dependencies.
Today’s software are getting more interacted and communication with a number of services and systems. For example a service could use a messaging server to receive and send messages to the interested parties through a messaging exchange. That strategy enables achieving abstracted systems. Similarly applications can be built with abstracted components so that an individual component can be tested in isolation while it is dependencies are mocked with different strategies. Testing individual components helps reducing some heavy weight functional tests and ensuring components are reliable to some degree.
Below code samples demonstrates building integration tests with Spring and Mockito, notice the code line mocking a spring bean.
Spring Factory & Mockito
This nice spring feature is a kind of hidden gem, maybe because of its a bit confusing "constructor-arg" naming. That parameter sounds like class constructor argument, however in reality it can be used for any method argument.
And here is the spring test context including main application context and abstracted test dependency. Separating spring context into multiple chunks helps building abstracted systems and allows plugging a mocked dependency into an integration test.