DAO unit tests

Let's say I use unit testing methods for UserDAO. I am writing a test for the UserDao removal method. First I inserted the user in db, then I called the delete method and checked if the object was saved.

My question is: to remove unit test, when I insert the user for testing, should I call the UserDao insertion method ... OR it would be better not to call any methods of the object that I'm testing and using in the native path, say using jdbc to enter and then call my delete method?

+3
source share
2 answers

DAOs are often too simple to break, then I think that it’s not worth spending resources on testing. Your explanation looks like this:

- ( ), .

, , .

+1

DBUnit - . DBUnit , , , ( , ), , . , , , , .

+1

Source: https://habr.com/ru/post/1764347/


All Articles