How to test Spring Data repositories?

前端 未结 8 1821
隐瞒了意图╮
隐瞒了意图╮ 2020-11-29 15:41

I want a repository (say, UserRepository) created with the help of Spring Data. I am new to spring-data (but not to spring) and I use this tutorial. My choice o

8条回答
  •  一个人的身影
    2020-11-29 15:43

    This may come a bit too late, but I have written something for this very purpose. My library will mock out the basic crud repository methods for you as well as interpret most of the functionalities of your query methods. You will have to inject functionalities for your own native queries, but the rest are done for you.

    Take a look:

    https://github.com/mmnaseri/spring-data-mock

    UPDATE

    This is now in Maven central and in pretty good shape.

提交回复
热议问题