Last active
April 22, 2018 19:23
-
-
Save petergtz/1e800ef11f9bf90dbee2226d6133482c to your computer and use it in GitHub Desktop.
An example of how to use Pegomock's InOrderContext
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create mocks: | |
blobstore := NewMockBlobstore() | |
updater := NewMockUpdater() | |
// Create object under test: | |
handler := NewResourceHandlerWithUpdater(blobstore, updater, ...) | |
... | |
// Make request against the Bits-Service resource handler: | |
handler.AddOrReplace(responseWriter, ..., map[string]string{"identifier": "someguid"}) | |
// Verify the handler's interactions with its collaborators: | |
inOrder := new(InOrderContext) | |
updater.VerifyWasCalledInOrder(Once(), inOrder).NotifyProcessingUpload("someguid") | |
blobstore.VerifyWasCalledInOrder(Once(), inOrder).Put(EqString("someguid"), AnyReadSeeker()) | |
updater.VerifyWasCalledInOrder(Once(), inOrder).NotifyUploadSucceeded("someguid", ...) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment