I am looping over a list table names to do the following
- Call describe table to check if the table exists
- If the table doesn't exist, throw ResourceNotFoundException.
- Call createTable method to create the table
- Call describe table to check if the table is created and is active.
- If not active, wait.
After the tables have been successfully created I want to change some properties of the table too.
So now the issue I'm facing is with unit tests.
I need to do these two
when(ddbClient.describeTable)
.thenThrow(ResourceNotFoundException.class)
.thenReturn(mockTableDescription);
But this only throws the exception. Is it because I have a loop? How exactly am I supposed write this test?