How do you mock repository interface in a service in hexagonal architecture
Atlasp opened this issue · 0 comments
Atlasp commented
Since we are returning domain objects (Beer) from a repository our repository is dependent on the domain package.
However, if you try and mock it with gomock it causes a cyclical dependency Because the mock imports from package and then the package improrts the mock so do I:
- Return another non-domain object from the repository (hard for slices of Beers for example)
- Put the Beer struct in another package
- Put the mock inside the package and not in its own folder.