In the prior section, we ran a test that does…nothing. Now it’s time to flesh it out with code that vets the ScoreCollection class.
We want to start with a scenario—a test case—that provides an example of expected behavior of the target code. To test a ScoreCollection object, we can add the numbers 5 and 7 to it and expect that the arithmeticMean method will return 6 (because (5 + 7) / 2 is equal to 6).
Naming is important. We call this test answersArithmeticMeanOfTwoNumbers—that nicely summarizes the scenario laid out in the test method. Here’s the code:
import static org.junit.Assert.*;
import static ...