Challenge: Grade System—Stubs and Mocks

Test your understanding of stubs and mocks with a grade system challenge using test-driven development (TDD) with Java.

Task and requirements

You’re given a GradesService class that calculates the average grades for a student. The GradesService depends on a Gradebook class, which retrieves the grades for a student. Your task is to write a test for the GradesService class using a stub to simulate the behavior of the Gradebook class.

  1. Implement a GradesService class with the following method:

Get hands-on with 1200+ tech skills courses.