JUnit test cases for custom rest controller in portal

Hi Everyone,

we have created a custom rest controller in portal that integrates with another REACT application.
we would like to write unit test case for this custom rest controller created in portal.
In the custom rest controller we have used datamanager, usersession and service created in middleware.
Could you please provide me with some suggestions on how I can write unit test cases for this controller?

We are currently using CUBA Platform - 7.0.12

Thanks in advance for the support.