Skip to content

Instantly share code, notes, and snippets.

@oliverspryn
Created October 21, 2021 21:52
Show Gist options
  • Select an option

  • Save oliverspryn/64cf682fd7f7bb271e50de3943ae1ed4 to your computer and use it in GitHub Desktop.

Select an option

Save oliverspryn/64cf682fd7f7bb271e50de3943ae1ed4 to your computer and use it in GitHub Desktop.
The mocking set up of a unit test where the output of one function is not streamed into the input of the next function, but uses a generic matcher
whenever(userService.getUserName()).thenReturn("jsmith")
whenever(userService.getUserId()).thenReturn("123-456")
whenever(userService.getUrlToAvatarImage(any())).thenReturn("https://ddg.co/") // Generic matcher is prone to error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment