Skip to content

Commit 5d65806

Browse files
committed
볼 카운팅이 제대로 되지 않는 버그 해결
1 parent 7357b5b commit 5d65806

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

number-baseball/src/main/java/io/github/gunkim/baseball/domain/BallNumbers.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public Result match(final BallNumbers otherBalls) {
2121

2222
if (myBall.equals(otherBall)) {
2323
strike++;
24-
} else if (hasBallNumber(myBall)) {
24+
} else if (hasBallNumber(otherBall)) {
2525
ball++;
2626
}
2727
}

number-baseball/src/test/java/io/github/gunkim/baseball/application/ConsoleInputTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ConsoleInputTest {
2828
}
2929

3030
@Test
31-
void test() {
31+
void 숫자_1에서_9_사이_숫자가_아닐_경우_예외가_발생한다() {
3232
final InputScanner mockInputScanner = () -> "abc";
3333
final ConsoleInput consoleInput = new ConsoleInput(mockInputScanner, 3);
3434

number-baseball/src/test/java/io/github/gunkim/baseball/domain/BallNumbersTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
import java.util.List;
77
import java.util.stream.Stream;
88

9-
import static org.junit.jupiter.api.Assertions.*;
9+
import static org.junit.jupiter.api.Assertions.assertAll;
10+
import static org.junit.jupiter.api.Assertions.assertEquals;
11+
import static org.junit.jupiter.api.Assertions.assertFalse;
12+
import static org.junit.jupiter.api.Assertions.assertTrue;
1013

1114
@DisplayName("BallNumbers는")
1215
class BallNumbersTest {
@@ -47,11 +50,11 @@ class BallNumbersTest {
4750
}
4851

4952
@Test
50-
public void 숫자123과_숫자231은_1스트라이크_2볼이다() {
53+
void 숫자123과_숫자231은_1스트라이크_2볼이다() {
5154
final var ballNumbers = new BallNumbers(Stream.of(1, 2, 3)
5255
.map(BallNumber::of)
5356
.toList());
54-
final var otherBallNumbers = new BallNumbers(Stream.of(2, 3, 1)
57+
final var otherBallNumbers = new BallNumbers(Stream.of(1, 3, 2)
5558
.map(BallNumber::of)
5659
.toList());
5760

0 commit comments

Comments
 (0)