MCPcopy
hub / github.com/stretchr/testify / Test_Mock_On_WithVariadicFuncWithInterface

Function Test_Mock_On_WithVariadicFuncWithInterface

mock/mock_test.go:483–503  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

481}
482
483func Test_Mock_On_WithVariadicFuncWithInterface(t *testing.T) {
484 t.Parallel()
485
486 // make a test impl object
487 var mockedService = new(TestExampleImplementation)
488
489 c := mockedService.On("TheExampleMethodVariadicInterface", []interface{}{1, 2, 3}).
490 Return(nil)
491
492 assert.Equal(t, []*Call{c}, mockedService.ExpectedCalls)
493 assert.Equal(t, 1, len(c.Arguments))
494 assert.Equal(t, []interface{}{1, 2, 3}, c.Arguments[0])
495
496 assert.NotPanics(t, func() {
497 mockedService.TheExampleMethodVariadicInterface(1, 2, 3)
498 })
499 assert.Panics(t, func() {
500 mockedService.TheExampleMethodVariadicInterface(1, 2)
501 })
502
503}
504
505func Test_Mock_On_WithVariadicFuncWithEmptyInterfaceArray(t *testing.T) {
506 t.Parallel()

Callers

nothing calls this directly

Calls 6

EqualFunction · 0.92
NotPanicsFunction · 0.92
PanicsFunction · 0.92
ReturnMethod · 0.80
OnMethod · 0.45

Tested by

no test coverage detected