How to test DAO methods using Mockito?

后端 未结 4 637
抹茶落季
抹茶落季 2021-01-31 09:24

I\'ve started to discovered Mockito library and there is a question for which I didn\'t find the proper answer.

If I have for example such method in my UserDAO class tha

4条回答
  •  有刺的猬
    2021-01-31 09:37

    But what if I want to also test the behavior of dao and database ?

    If you indeed want to test the database (as you should!), there's no way around it - you need an actual database. Mockito, albeit being a great library, is probably the wrong tool for this job.

提交回复
热议问题