func (m *Mock) Times(i int) {
	m.mutex.Lock()
	m.ExpectedCalls[len(m.ExpectedCalls)-1].Repeatability = i
	m.mutex.Unlock()
}
Times indicates that that the mock should only return the indicated number
of times.

Mock.On("MyMethod", arg1, arg2).Return(returnArg1, returnArg2).Times(5)
package mock
import (
	"fmt"
	"reflect"
	"runtime"
	"strings"
	"sync"
	"time"
	"github.com/stretchr/objx"
	"github.com/stretchr/testify/assert"
)
type TestingT interface {
	Logf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
}
type Call struct {
	Method string
	Arguments Arguments
	ReturnArguments Arguments
	Repeatability int
	WaitFor <-chan time.Time
	Run func(Arguments)
}
type Mock struct {
	onMethodName string
	onMethodArguments Arguments
	ExpectedCalls []Call
	Calls []Call
	testData objx.Map
	mutex sync.Mutex
}
func (m *Mock) TestData() objx.Map {
	if m.testData == nil {
		m.testData = make(objx.Map)
	}
	return m.testData
}
func (m *Mock) On(methodName string, arguments ...interface{}) *Mock {
	m.onMethodName = methodName
	m.onMethodArguments = arguments
	for _, arg := range arguments {
		if v := reflect.ValueOf(arg); v.Kind() == reflect.Func {
			panic(fmt.Sprintf("cannot use Func in expectations. Use mock.AnythingOfType(\"%T\")", arg))
		}
	}
	return m
}
func (m *Mock) Return(returnArguments ...interface{}) *Mock {
	m.mutex.Lock()
	defer m.mutex.Unlock()
	m.ExpectedCalls = append(m.ExpectedCalls, Call{m.onMethodName, m.onMethodArguments, returnArguments, 0, nil, nil})
	return m
}
func (m *Mock) Once() {
	m.mutex.Lock()
	m.ExpectedCalls[len(m.ExpectedCalls)-1].Repeatability = 1
	m.mutex.Unlock()
}
func (m *Mock) Twice() {
	m.mutex.Lock()
	m.ExpectedCalls[len(m.ExpectedCalls)-1].Repeatability = 2
	m.mutex.Unlock()
}