IsMethodCallable checking that the method can be called If the method was called more than `Repeatability` return false
(t TestingT, methodName string, arguments ...interface{})
| 715 | // IsMethodCallable checking that the method can be called |
| 716 | // If the method was called more than `Repeatability` return false |
| 717 | func (m *Mock) IsMethodCallable(t TestingT, methodName string, arguments ...interface{}) bool { |
| 718 | if h, ok := t.(tHelper); ok { |
| 719 | h.Helper() |
| 720 | } |
| 721 | m.mutex.Lock() |
| 722 | defer m.mutex.Unlock() |
| 723 | |
| 724 | for _, v := range m.ExpectedCalls { |
| 725 | if v.Method != methodName { |
| 726 | continue |
| 727 | } |
| 728 | if len(arguments) != len(v.Arguments) { |
| 729 | continue |
| 730 | } |
| 731 | if v.Repeatability < v.totalCalls { |
| 732 | continue |
| 733 | } |
| 734 | if isArgsEqual(v.Arguments, arguments) { |
| 735 | return true |
| 736 | } |
| 737 | } |
| 738 | return false |
| 739 | } |
| 740 | |
| 741 | // isArgsEqual compares arguments |
| 742 | func isArgsEqual(expected Arguments, args []interface{}) bool { |