Skip to content

Instantly share code, notes, and snippets.

@prantoran
Last active April 27, 2018 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prantoran/a98c8061c74e1d6506c27229f9743de1 to your computer and use it in GitHub Desktop.
Save prantoran/a98c8061c74e1d6506c27229f9743de1 to your computer and use it in GitHub Desktop.
package mocks
import "github.com/prantoran/go-mock-microservice/printer"
type PrintFunc func(string) (*printer.Resp, error)
type MockPrinter struct {
MockPrintFunc PrintFunc
}
func (m *MockPrinter) SetPrintFunc(f PrintFunc) {
m.MockPrintFunc = f
}
func (m *MockPrinter) Print(s string) (*printer.Resp, error) {
return m.MockPrintFunc(s)
}
func NewMockPrinter() *MockPrinter {
return &MockPrinter{}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment