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

Function Test_Mock_On_WithIntArgMatcher

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

Source from the content-addressed store, hash-verified

255}
256
257func Test_Mock_On_WithIntArgMatcher(t *testing.T) {
258 t.Parallel()
259
260 var mockedService TestExampleImplementation
261
262 mockedService.On("TheExampleMethod",
263 MatchedBy(func(a int) bool {
264 return a == 1
265 }), MatchedBy(func(b int) bool {
266 return b == 2
267 }), MatchedBy(func(c int) bool {
268 return c == 3
269 })).Return(0, nil)
270
271 assert.Panics(t, func() {
272 mockedService.TheExampleMethod(1, 2, 4)
273 })
274 assert.Panics(t, func() {
275 mockedService.TheExampleMethod(2, 2, 3)
276 })
277 assert.NotPanics(t, func() {
278 mockedService.TheExampleMethod(1, 2, 3)
279 })
280}
281
282func Test_Mock_On_WithArgMatcherThatPanics(t *testing.T) {
283 t.Parallel()

Callers

nothing calls this directly

Calls 6

TheExampleMethodMethod · 0.95
PanicsFunction · 0.92
NotPanicsFunction · 0.92
MatchedByFunction · 0.85
ReturnMethod · 0.80
OnMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…