Hi, I am trying to write a Junit test for cosmos db pagination exception. I am using Mockito. Here is what the code looks like:
In this code, I am trying to get all customers from db, but if I encounter a request that is requesting a page that does not exist (out of the range),
for example, there is total element of 500 but someone is sending request - localhost:8000/customers?page=60&size=10
I will throw a pagination exception and return bad request 400 status code.
I want to write a test for shouldThrowPaginationException but I do not know how to get to this exception in the Junit test. What can I mock to be able to trigger this exception?
Does anyone have experiences writing Junit test for cosmos db pagination? Can you please give me some advice? Thanks