refactor
This commit is contained in:
parent
5926655a54
commit
0cd27b8d31
@ -54,7 +54,7 @@ public class Game {
|
||||
return;
|
||||
default:
|
||||
int i = Integer.parseInt(line);
|
||||
player.toggleMark(i);
|
||||
player.toggleMarked(i);
|
||||
System.out.println(player);
|
||||
break;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public class Player implements DiceInteraction{
|
||||
.forEach(Dice::roll);
|
||||
}
|
||||
|
||||
public void toggleMark(int diceIdx) throws SelectionException {
|
||||
public void toggleMarked(int diceIdx) throws SelectionException {
|
||||
if (diceIdx < 0 || diceIdx >= dices.length) {
|
||||
throw new SelectionException("Invalid dice index: " + diceIdx);
|
||||
}
|
||||
@ -159,7 +159,7 @@ public class Player implements DiceInteraction{
|
||||
|
||||
@Override
|
||||
public int changeDiceState(int diceIdx) throws SelectionException {
|
||||
toggleMark(diceIdx);
|
||||
toggleMarked(diceIdx);
|
||||
return roundScore + selectionScore();
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class PlayerTest {
|
||||
|
||||
int diceIdx = 1;
|
||||
|
||||
player.toggleMark(diceIdx);
|
||||
player.toggleMarked(diceIdx);
|
||||
expected = "0 + 50: 4 (5) 6 6 2 6 ";
|
||||
assertEquals(expected, player.toStringHelper());
|
||||
|
||||
@ -45,7 +45,7 @@ class PlayerTest {
|
||||
expected = "0 + 50: 1 [5] 2 5 4 2 ";
|
||||
assertEquals(expected, player.toStringHelper());
|
||||
|
||||
assertThrows(IllegalArgumentException.class, () -> player.toggleMark(diceIdx));
|
||||
assertThrows(IllegalArgumentException.class, () -> player.toggleMarked(diceIdx));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user