@Test public void checkAllScores() { int highestScore = Math.max(this.player1Score, this.player2Score); for (int i = 0; i < highestScore; i++) { if (i < this.player1Score) game.wonPoint(federer); if (i < this.player2Score) game.wonPoint(nadal); } Assert.assertEquals(this.expectedScore, game.getScore()); }
@Test public void realisticGame() { Player[] points = {federer, federer, nadal, nadal, federer, federer}; String[] expected_scores = {"Fifteen-Love", "Thirty-Love", "Thirty-Fifteen", "Thirty-All", "Forty-Thirty", "Win for player1"}; for (int i = 0; i < 6; i++) { game.wonPoint(points[i]); Assert.assertEquals(expected_scores[i], game.getScore()); } }