Skip to content

Commit b9b333e

Browse files
feat(internal): add Maybe() to MockCallWrapper (#1479)
Signed-off-by: Jingyu Cai <jingyu.cai@uber.com> Co-authored-by: Jingyu Cai <jingyu.cai@uber.com>
1 parent 3d40460 commit b9b333e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

internal/workflow_testsuite.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,13 @@ func (c *MockCallWrapper) Times(i int) *MockCallWrapper {
404404
return c
405405
}
406406

407+
// Maybe indicates that the mock is optional.
408+
// Not calling an optional mock will not cause an error while asserting expectations.
409+
func (c *MockCallWrapper) Maybe() *MockCallWrapper {
410+
c.call.Maybe()
411+
return c
412+
}
413+
407414
// Run sets a handler to be called before returning. It can be used when mocking a method such as unmarshalers that
408415
// takes a pointer to a struct and sets properties in such struct.
409416
func (c *MockCallWrapper) Run(fn func(args mock.Arguments)) *MockCallWrapper {

0 commit comments

Comments
 (0)