mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2025-12-12 12:22:12 +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
|
@Test
|
||||||
public void checkAllScores() {
|
public void checkAllScores() {
|
||||||
TennisGame game = new TennisGame("player1", "player2");
|
TennisGame game = new TennisGame("player1", "player2");
|
||||||
for (int i = 0; i < this.player1Score; i++)
|
int highestScore = Math.max(this.player1Score, this.player2Score);
|
||||||
game.wonPoint("player1");
|
for (int i = 0; i < highestScore; i++) {
|
||||||
for (int i = 0; i < this.player2Score; i++)
|
if (i < this.player1Score)
|
||||||
game.wonPoint("player2");
|
game.wonPoint("player1");
|
||||||
|
if (i < this.player2Score)
|
||||||
|
game.wonPoint("player2");
|
||||||
|
}
|
||||||
assertEquals(this.expectedScore, game.getScore());
|
assertEquals(this.expectedScore, game.getScore());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -71,10 +71,13 @@ public class TennisTest {
|
|||||||
@Test
|
@Test
|
||||||
public void checkAllScores() {
|
public void checkAllScores() {
|
||||||
TennisGame game = new TennisGame("player1", "player2");
|
TennisGame game = new TennisGame("player1", "player2");
|
||||||
for (int i = 0; i < this.player1Score; i++)
|
int highestScore = Math.max(this.player1Score, this.player2Score);
|
||||||
game.wonPoint("player1");
|
for (int i = 0; i < highestScore; i++) {
|
||||||
for (int i = 0; i < this.player2Score; i++)
|
if (i < this.player1Score)
|
||||||
game.wonPoint("player2");
|
game.wonPoint("player1");
|
||||||
|
if (i < this.player2Score)
|
||||||
|
game.wonPoint("player2");
|
||||||
|
}
|
||||||
assertEquals(this.expectedScore, game.getScore());
|
assertEquals(this.expectedScore, game.getScore());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -71,10 +71,13 @@ public class TennisTest {
|
|||||||
@Test
|
@Test
|
||||||
public void checkAllScores() {
|
public void checkAllScores() {
|
||||||
TennisGame game = new TennisGame("player1", "player2");
|
TennisGame game = new TennisGame("player1", "player2");
|
||||||
for (int i = 0; i < this.player1Score; i++)
|
int highestScore = Math.max(this.player1Score, this.player2Score);
|
||||||
game.wonPoint("player1");
|
for (int i = 0; i < highestScore; i++) {
|
||||||
for (int i = 0; i < this.player2Score; i++)
|
if (i < this.player1Score)
|
||||||
game.wonPoint("player2");
|
game.wonPoint("player1");
|
||||||
|
if (i < this.player2Score)
|
||||||
|
game.wonPoint("player2");
|
||||||
|
}
|
||||||
assertEquals(this.expectedScore, game.getScore());
|
assertEquals(this.expectedScore, game.getScore());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -70,10 +70,13 @@ public class TennisTest {
|
|||||||
@Test
|
@Test
|
||||||
public void checkAllScores() {
|
public void checkAllScores() {
|
||||||
TennisGame game = new TennisGame("player1", "player2");
|
TennisGame game = new TennisGame("player1", "player2");
|
||||||
for (int i = 0; i < this.player1Score; i++)
|
int highestScore = Math.max(this.player1Score, this.player2Score);
|
||||||
game.wonPoint("player1");
|
for (int i = 0; i < highestScore; i++) {
|
||||||
for (int i = 0; i < this.player2Score; i++)
|
if (i < this.player1Score)
|
||||||
game.wonPoint("player2");
|
game.wonPoint("player1");
|
||||||
|
if (i < this.player2Score)
|
||||||
|
game.wonPoint("player2");
|
||||||
|
}
|
||||||
assertEquals(this.expectedScore, game.getScore());
|
assertEquals(this.expectedScore, game.getScore());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user