How to use mockery in golang

mockery

Installation

1
brew install mockery

How to use

create a interface

1
2
3
4
5
package test

type Tester interface {
Test(val int) bool
}

open your Terminal and cd to the interface directory and input mocker --name ${YOUR_INTERFACE_NAME}

1
mockery --name Tester

then it will generate mocks folder and mock code