Reputation: 21
I have Business component, Controller,Service,ServiceImpl. I have selected data from DB using stringBuilder and performed some calculations and inserted data from the variables that I took from DB. How to write Junit test for to check data that I selected from DB and the Data that I have inserted in DB?
Upvotes: 2
Views: 577
Reputation: 1118
You can use DBUnit tool. Generally the tool is able to generate "expected" dataset from xml files, connect to database and retrieve "actual" dataset and check assertions. Examples are here: https://www.baeldung.com/java-dbunit
Upvotes: 1