func (t *DoAllTest) MultipleActions() { f := func(a int) string { return "" } var saved int a0 := oglemock.SaveArg(0, &saved) a1 := oglemock.Return("taco") action := oglemock.DoAll(a0, a1) AssertEq(nil, action.SetSignature(reflect.TypeOf(f))) rets := action.Invoke([]interface{}{17}) ExpectEq(17, saved) ExpectThat(rets, ElementsAre("taco")) }
func (t *EncryptingStore_StoreTest) CallsWrapped() { // Crypter encryptedBlob := []byte{0xde, 0xad} ExpectCall(t.crypter, "Encrypt")(Any(), Any()). WillOnce(oglemock.Return(encryptedBlob, nil)) // Wrapped var req *blob.StoreRequest ExpectCall(t.wrapped, "Store")(Any(), Any()). WillOnce(oglemock.DoAll( oglemock.SaveArg(1, &req), oglemock.Return(blob.Score{}, errors.New("")))) // Call t.store.Store(t.ctx, &blob.StoreRequest{}) AssertNe(nil, req) ExpectThat(req.Blob, DeepEquals(encryptedBlob)) }