kubernetes/vendor/github.com/stretchr/testify/mock/mock.go

var gccgoRE

type TestingT

type Call

func newCall(parent *Mock, methodName string, callerInfo []string, methodArguments ...interface{}

func (c *Call) lock() {}

func (c *Call) unlock() {}

// Return specifies the return arguments for the expectation.
//
//	Mock.On("DoSomething").Return(errors.New("failed"))
func (c *Call) Return(returnArguments ...interface{}

// Panic specifies if the function call should fail and the panic message
//
//	Mock.On("DoSomething").Panic("test panic")
func (c *Call) Panic(msg string) *Call {}

// Once indicates that the mock should only return the value once.
//
//	Mock.On("MyMethod", arg1, arg2).Return(returnArg1, returnArg2).Once()
func (c *Call) Once() *Call {}

// Twice indicates that the mock should only return the value twice.
//
//	Mock.On("MyMethod", arg1, arg2).Return(returnArg1, returnArg2).Twice()
func (c *Call) Twice() *Call {}

// Times indicates that the mock should only return the indicated number
// of times.
//
//	Mock.On("MyMethod", arg1, arg2).Return(returnArg1, returnArg2).Times(5)
func (c *Call) Times(i int) *Call {}

// WaitUntil sets the channel that will block the mock's return until its closed
// or a message is received.
//
//	Mock.On("MyMethod", arg1, arg2).WaitUntil(time.After(time.Second))
func (c *Call) WaitUntil(w <-chan time.Time) *Call {}

// After sets how long to block until the call returns
//
//	Mock.On("MyMethod", arg1, arg2).After(time.Second)
func (c *Call) After(d time.Duration) *Call {}

// Run sets a handler to be called before returning. It can be used when
// mocking a method (such as an unmarshaler) that takes a pointer to a struct and
// sets properties in such struct
//
//	Mock.On("Unmarshal", AnythingOfType("*map[string]interface{}")).Return().Run(func(args Arguments) {
//		arg := args.Get(0).(*map[string]interface{})
//		arg["foo"] = "bar"
//	})
func (c *Call) Run(fn func(args Arguments)) *Call {}

// Maybe allows the method call to be optional. Not calling an optional method
// will not cause an error while asserting expectations
func (c *Call) Maybe() *Call {}

// On chains a new expectation description onto the mocked interface. This
// allows syntax like.
//
//	Mock.
//	   On("MyMethod", 1).Return(nil).
//	   On("MyOtherMethod", 'a', 'b', 'c').Return(errors.New("Some Error"))
//
//go:noinline
func (c *Call) On(methodName string, arguments ...interface{}

// Unset removes a mock handler from being called.
//
//	test.On("func", mock.Anything).Unset()
func (c *Call) Unset() *Call {}

// NotBefore indicates that the mock should only be called after the referenced
// calls have been called as expected. The referenced calls may be from the
// same mock instance and/or other mock instances.
//
//	Mock.On("Do").Return(nil).Notbefore(
//	    Mock.On("Init").Return(nil)
//	)
func (c *Call) NotBefore(calls ...*Call) *Call {}

type Mock

// String provides a %v format string for Mock.
// Note: this is used implicitly by Arguments.Diff if a Mock is passed.
// It exists because go's default %v formatting traverses the struct
// without acquiring the mutex, which is detected by go test -race.
func (m *Mock) String() string {}

// TestData holds any data that might be useful for testing.  Testify ignores
// this data completely allowing you to do whatever you like with it.
func (m *Mock) TestData() objx.Map {}

// Test sets the test struct variable of the mock object
func (m *Mock) Test(t TestingT) {}

// fail fails the current test with the given formatted format and args.
// In case that a test was defined, it uses the test APIs for failing a test,
// otherwise it uses panic.
func (m *Mock) fail(format string, args ...interface{}

// On starts a description of an expectation of the specified method
// being called.
//
//	Mock.On("MyMethod", arg1, arg2)
func (m *Mock) On(methodName string, arguments ...interface{}

func (m *Mock) findExpectedCall(method string, arguments ...interface{}

type matchCandidate

func (c matchCandidate) isBetterMatchThan(other matchCandidate) bool {}

func (m *Mock) findClosestCall(method string, arguments ...interface{}

func callString(method string, arguments Arguments, includeArgumentValues bool) string {}

// Called tells the mock object that a method has been called, and gets an array
// of arguments to return.  Panics if the call is unexpected (i.e. not preceded by
// appropriate .On .Return() calls)
// If Call.WaitFor is set, blocks until the channel is closed or receives a message.
func (m *Mock) Called(arguments ...interface{}

// MethodCalled tells the mock object that the given method has been called, and gets
// an array of arguments to return. Panics if the call is unexpected (i.e. not preceded
// by appropriate .On .Return() calls)
// If Call.WaitFor is set, blocks until the channel is closed or receives a message.
func (m *Mock) MethodCalled(methodName string, arguments ...interface{}

type assertExpectationiser

// AssertExpectationsForObjects asserts that everything specified with On and Return
// of the specified objects was in fact called as expected.
//
// Calls may have occurred in any order.
func AssertExpectationsForObjects(t TestingT, testObjects ...interface{}

// AssertExpectations asserts that everything specified with On and Return was
// in fact called as expected.  Calls may have occurred in any order.
func (m *Mock) AssertExpectations(t TestingT) bool {}

func (m *Mock) checkExpectation(call *Call) (bool, string) {}

// AssertNumberOfCalls asserts that the method was called expectedCalls times.
func (m *Mock) AssertNumberOfCalls(t TestingT, methodName string, expectedCalls int) bool {}

// AssertCalled asserts that the method was called.
// It can produce a false result when an argument is a pointer type and the underlying value changed after calling the mocked method.
func (m *Mock) AssertCalled(t TestingT, methodName string, arguments ...interface{}

// AssertNotCalled asserts that the method was not called.
// It can produce a false result when an argument is a pointer type and the underlying value changed after calling the mocked method.
func (m *Mock) AssertNotCalled(t TestingT, methodName string, arguments ...interface{}

// IsMethodCallable checking that the method can be called
// If the method was called more than `Repeatability` return false
func (m *Mock) IsMethodCallable(t TestingT, methodName string, arguments ...interface{}

// isArgsEqual compares arguments
func isArgsEqual(expected Arguments, args []interface{}

func (m *Mock) methodWasCalled(methodName string, expected []interface{}

func (m *Mock) expectedCalls() []*Call {}

func (m *Mock) calls() []Call {}

type Arguments

const Anything

type AnythingOfTypeArgument

type anythingOfTypeArgument

// AnythingOfType returns a special value containing the
// name of the type to check for. The type name will be matched against the type name returned by [reflect.Type.String].
//
// Used in Diff and Assert.
//
// For example:
//
//	Assert(t, AnythingOfType("string"), AnythingOfType("int"))
func AnythingOfType(t string) AnythingOfTypeArgument {}

type IsTypeArgument

// IsType returns an IsTypeArgument object containing the type to check for.
// You can provide a zero-value of the type to check.  This is an
// alternative to AnythingOfType.  Used in Diff and Assert.
//
// For example:
// Assert(t, IsType(""), IsType(0))
func IsType(t interface{}

type FunctionalOptionsArgument

// String returns the string representation of FunctionalOptionsArgument
func (f *FunctionalOptionsArgument) String() string {}

// FunctionalOptions returns an FunctionalOptionsArgument object containing the functional option type
// and the values to check of
//
// For example:
// Assert(t, FunctionalOptions("[]foo.FunctionalOption", foo.Opt1(), foo.Opt2()))
func FunctionalOptions(value ...interface{}

type argumentMatcher

func (f argumentMatcher) Matches(argument interface{}

func (f argumentMatcher) String() string {}

// MatchedBy can be used to match a mock call based on only certain properties
// from a complex struct or some calculation. It takes a function that will be
// evaluated with the called argument and will return true when there's a match
// and false otherwise.
//
// Example:
// m.On("Do", MatchedBy(func(req *http.Request) bool { return req.Host == "example.com" }))
//
// |fn|, must be a function accepting a single argument (of the expected type)
// which returns a bool. If |fn| doesn't match the required signature,
// MatchedBy() panics.
func MatchedBy(fn interface{}

// Get Returns the argument at the specified index.
func (args Arguments) Get(index int) interface{}

// Is gets whether the objects match the arguments specified.
func (args Arguments) Is(objects ...interface{}

// Diff gets a string describing the differences between the arguments
// and the specified objects.
//
// Returns the diff string and number of differences found.
func (args Arguments) Diff(objects []interface{}

// Assert compares the arguments with the specified objects and fails if
// they do not exactly match.
func (args Arguments) Assert(t TestingT, objects ...interface{}

// String gets the argument at the specified index. Panics if there is no argument, or
// if the argument is of the wrong type.
//
// If no index is provided, String() returns a complete string representation
// of the arguments.
func (args Arguments) String(indexOrNil ...int) string {}

// Int gets the argument at the specified index. Panics if there is no argument, or
// if the argument is of the wrong type.
func (args Arguments) Int(index int) int {}

// Error gets the argument at the specified index. Panics if there is no argument, or
// if the argument is of the wrong type.
func (args Arguments) Error(index int) error {}

// Bool gets the argument at the specified index. Panics if there is no argument, or
// if the argument is of the wrong type.
func (args Arguments) Bool(index int) bool {}

func typeAndKind(v interface{}

func diffArguments(expected Arguments, actual Arguments) string {}

// diff returns a diff of both values as long as both are of the same type and
// are a struct, map, slice or array. Otherwise it returns an empty string.
func diff(expected interface{}

var spewConfig

type tHelper

func assertOpts(expected, actual interface{}

func funcName(opt interface{}