I am trying to test a method that uses DynamoDBMapper to query items from a dyamoDB table.
My method works fine but the problem comes when I'm trying to test.
I'm using Junt4 and Mockito. Basically, I'm just trying to test that my method does its logic with the results fetched from dynamo. In my test, I'm trying to mock those results.
//What I'm trying to mock
mapper.query(DDBProductDocument.class, queryExpression);
//What I have in my test
@MockBean
PaginatedQueryList paginatedQueryList;
when(mapper.query(
Mockito.any(),
Mockito.any()
)).thenReturn(paginatedQueryList);
paginated List should be a list of my mocked results, however, I can't just return my desired mocked results. Has anyone else successfully mocked this? thanks.