when(gradebook.gradesFor(student)) is also a mock. Because if the method gradesFor is called with another parameter, will never return what we expected.
You are not explicit doing a mock as when using "verify", but is still mock.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Perfect. Very clean explanation.
I would just add that regarding this part of the code:
when(gradebook.gradesFor(student)).thenReturn(grades(8, 6, 10));
The first part:
when(gradebook.gradesFor(student)) is also a mock. Because if the method gradesFor is called with another parameter, will never return what we expected.
You are not explicit doing a mock as when using "verify", but is still mock.