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.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.