Skip to content

How do you mock repository interface in a service in hexagonal architecture #40

@Atlasp

Description

@Atlasp

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:

  1. Return another non-domain object from the repository (hard for slices of Beers for example)
  2. Put the Beer struct in another package
  3. Put the mock inside the package and not in its own folder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions