'How to write Junit test for to check data that I selected from DB and the Data that I have inserted in DB
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?
Solution 1:[1]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
