title: Mock interface method twice with different input and output using testify
body: <p>How can I mock an interface method twice in golang test? For example:</p>
  <pre class="lang-golang prettyprint-override"><code>type myCache interface{
      Get(key string, data interface{}) error
  }
  
  type service struct {
      cache myCache
  }
  
  func (s service) GetBookDetail() (BookDetail, error) {
      ...
      book := Book{}
      err := s.cache.Get(&quot;book&quot;, &amp;book)
      if err != nil {
          return BookDetail{}, err
      }
      ...
      author := Author{}
      err := s.cache.Get(&quot;author&quot;, &amp;author)
      if err != nil {
          return BookDetail{}, err
      }
      ...
  }
  </code></pre>
  <p>When I test <code>func GetBookDetail()</code>, how can I mock <code>Get(key string, data interface{}) error</code> twice? I try to do this but its failed:</p>
  <pre class="lang-golang prettyprint-override"><code>func TestGetBookDetail(t *testing.T) {
      ...
  
      mockCache.On(&quot;Get&quot;,
          mock.MatchedBy(func(key string) bool {
              return key == &quot;book&quot;
          }), mock.MatchedBy(func(data interface{}) bool {
              return data == &amp;Book{}
          })).Return(nil)
  
      mockCache.On(&quot;Get&quot;,
          mock.MatchedBy(func(key string) bool {
              return key == &quot;author&quot;
          }), mock.MatchedBy(func(data interface{}) bool {
              return data == &amp;Author{}
          })).Return(nil)
      ...
      out, err := mockService.GetBookDetail()
      ...
  }
  </code></pre>
  <p>Got error in test something like this:</p>
  <blockquote>
  <p>Diff:</p>
  <p>0: PASS:  (string=book) matched by func(string) bool</p>
  <p>1: FAIL:  (*Book=&amp;{    }) not matched by func() bool [recovered]</p>
  <p>panic:</p>
  </blockquote>
  <p>Note: I use <code>github.com/stretchr/testify</code></p>