Announcement Announcement Module
Collapse
No announcement yet.
Best practices for mocking Repository Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Best practices for mocking Repository

    Hi all,

    First of all sorry for the double posting (I asked this in the NOSQL forum wiht no luck some days ago)

    I've started using the MongoDb Spring Data and I have some services with references to different Repository interfaces (extending PagingAndSortingRepository).

    I'd like to unit test these services injecting repository doubles or mocks.

    Does Spring Data / MongoDb provide any testing facilities in these regards? Are there any practices to follow in this field or should I create my own mocks?

    Many thanks in advance

  • #2
    "I'd like to unit test these services injecting repository doubles or mocks."
    it is not possible.

    Comment


    • #3
      Why shouldn't it? As the repositories are interfaces only you can easily exchange them using a general purpose mocking library like Mockito, EasyMock or jMockit. Have a look at the Spring Data test cases for a general impression of how to use Mockito for example.

      Comment

      Working...
      X