Reputation: 13
I have a spring boot rest endpoint that executes a simple service. That service can change it's execution based on a data in a table.
The simplest way I can describe it is imagine a calculator API. I can unit test the /multiply end point to ensure a static value of 2 and 3 produce 6.
Now let's pretend my table has a million rows with all of those combinations. 1,2 and 2,3 and 3,6 etc.
What is a good way to test all of that rules data? I feel like those rules need to be tested but an integration test seems too slow and brittle.
Any ideas?
Upvotes: 1
Views: 33
Reputation: 46
I would first advise not on make DB call in unit tests.
You can use Datasources or parametrized tests from Junit5 ,whose purpose is to provide different sets of data to the test.
https://www.lenar.io/junit5-dataprovider-analogue-example/
Upvotes: 1