Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save petergtz/28fc08c681c96af7a060bb2f7c7c3dc2 to your computer and use it in GitHub Desktop.
Save petergtz/28fc08c681c96af7a060bb2f7c7c3dc2 to your computer and use it in GitHub Desktop.
// Stubbing:
When(updater.NotifyUploadSucceeded(AnyString(), AnyString(), AnyString())).
ThenReturn(fmt.Errorf("Some error"))
// Exercise object under test:
handler.AddOrReplace(responseWriter, ..., map[string]string{"identifier": "someguid"})
// Verification:
blobstore.VerifyWasCalledOnce().Put(EqString("someguid"), AnyReadSeeker())
updater.VerifyWasCalled(Never()).NotifyUploadFailed(AnyString(), AnyError())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment