mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2025-12-12 04:12:13 +00:00
made the test code more realistic - have each player score a point in turn instead of all at once.
This commit is contained in:
parent
52fb51eede
commit
1cf0963de5
@ -71,10 +71,13 @@ public class TennisTest {
|
||||
@Test
|
||||
public void checkAllScores() {
|
||||
TennisGame game = new TennisGame("player1", "player2");
|
||||
for (int i = 0; i < this.player1Score; i++)
|
||||
game.wonPoint("player1");
|
||||
for (int i = 0; i < this.player2Score; i++)
|
||||
game.wonPoint("player2");
|
||||
int highestScore = Math.max(this.player1Score, this.player2Score);
|
||||
for (int i = 0; i < highestScore; i++) {
|
||||
if (i < this.player1Score)
|
||||
game.wonPoint("player1");
|
||||
if (i < this.player2Score)
|
||||
game.wonPoint("player2");
|
||||
}
|
||||
assertEquals(this.expectedScore, game.getScore());
|
||||
}
|
||||
|
||||
|
||||
@ -71,10 +71,13 @@ public class TennisTest {
|
||||
@Test
|
||||
public void checkAllScores() {
|
||||
TennisGame game = new TennisGame("player1", "player2");
|
||||
for (int i = 0; i < this.player1Score; i++)
|
||||
game.wonPoint("player1");
|
||||
for (int i = 0; i < this.player2Score; i++)
|
||||
game.wonPoint("player2");
|
||||
int highestScore = Math.max(this.player1Score, this.player2Score);
|
||||
for (int i = 0; i < highestScore; i++) {
|
||||
if (i < this.player1Score)
|
||||
game.wonPoint("player1");
|
||||
if (i < this.player2Score)
|
||||
game.wonPoint("player2");
|
||||
}
|
||||
assertEquals(this.expectedScore, game.getScore());
|
||||
}
|
||||
|
||||
|
||||
@ -71,10 +71,13 @@ public class TennisTest {
|
||||
@Test
|
||||
public void checkAllScores() {
|
||||
TennisGame game = new TennisGame("player1", "player2");
|
||||
for (int i = 0; i < this.player1Score; i++)
|
||||
game.wonPoint("player1");
|
||||
for (int i = 0; i < this.player2Score; i++)
|
||||
game.wonPoint("player2");
|
||||
int highestScore = Math.max(this.player1Score, this.player2Score);
|
||||
for (int i = 0; i < highestScore; i++) {
|
||||
if (i < this.player1Score)
|
||||
game.wonPoint("player1");
|
||||
if (i < this.player2Score)
|
||||
game.wonPoint("player2");
|
||||
}
|
||||
assertEquals(this.expectedScore, game.getScore());
|
||||
}
|
||||
|
||||
|
||||
@ -70,10 +70,13 @@ public class TennisTest {
|
||||
@Test
|
||||
public void checkAllScores() {
|
||||
TennisGame game = new TennisGame("player1", "player2");
|
||||
for (int i = 0; i < this.player1Score; i++)
|
||||
game.wonPoint("player1");
|
||||
for (int i = 0; i < this.player2Score; i++)
|
||||
game.wonPoint("player2");
|
||||
int highestScore = Math.max(this.player1Score, this.player2Score);
|
||||
for (int i = 0; i < highestScore; i++) {
|
||||
if (i < this.player1Score)
|
||||
game.wonPoint("player1");
|
||||
if (i < this.player2Score)
|
||||
game.wonPoint("player2");
|
||||
}
|
||||
assertEquals(this.expectedScore, game.getScore());
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user