Mocking Repository with Golang GoMock
Published in
3 min readApr 24, 2023
Generating mocks
is common use case when we write unit testing
. In this article, we will learn how to create mocks and use it for testing, we will use GoMock
for creating mocks.
Use Case
We have CategoryService
and CategoryRepository
. When we call method in CategoryService
, it will call CategoryRepository
for fetching data.