Beispiel #1
0
// ByteArrayArg gets the argument at the specified index. Panics if there is no
// argument, or if the argument is of the wrong type.
func ByteArrayArg(args mock.Arguments, index int) []byte {
	var s []byte
	var ok bool
	if s, ok = args.Get(index).([]byte); !ok {
		panic(fmt.Sprintf("assert: arguments: ByteArrayArg(%d) failed because object wasn't correct type: %v", index, args.Get(index)))
	}
	return s
}
Beispiel #2
0
func (m *MockConn) Do(cmd string, cmdArgs ...interface{}) (interface{}, error) {
	m.Mutex.Lock()
	defer m.Mutex.Unlock()
	var args mock.Arguments
	if len(cmdArgs) == 0 {
		args = m.Mock.Called(cmd)
	} else {
		args = m.Mock.Called(cmd, cmdArgs)
	}
	return args.Get(0), args.Error(1)
}
Beispiel #3
0
func status(args mock.Arguments, at int) (val mesos.Status) {
	if x := args.Get(at); x != nil {
		val = x.(mesos.Status)
	}
	return
}