Use Mockito to create stubbed query responses when testing implementations of the Entity Manager API.
The Entity Manager API is used to create instances for persistance that fall on the repository layer of a Spring application.
The Entity Manager will manage the lifecycle fo the entity instances for persistance, and can be highly important when persisting and managing data for an application.
This video will use Mockito to stub an EntityManager and Query to control the response of an EntityManager for testing a simple select query.
Link to source code: https://github.com/4neesh/YouTube-Cha...
#Mockito #JUnit #Tutorial
🕒 Timestamps 🕒
00:00 - Introduction
00:53 - Class under test
02:30 - Mock the entity manager
03:30 - Mock Query instance
05:10 - Walk through solution
Icon created by FreePik from www.flaticon.com