-
Notifications
You must be signed in to change notification settings - Fork 415
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
74 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,5 +10,4 @@ public Player toggle() { | |
} | ||
return WHITE; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ | |
<body> | ||
Hello World!! | ||
</body> | ||
</html> | ||
</html |
18 changes: 18 additions & 0 deletions
18
src/test/java/chess/domain/board/ManipulatedBoardInitializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package chess.domain.board; | ||
|
||
import chess.domain.piece.PieceState; | ||
import chess.domain.position.Position; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class ManipulatedBoardInitializer implements BoardInitializer { | ||
|
||
@Override | ||
public Map<Position, PieceState> create() { | ||
Map<Position, PieceState> initialBoard = new HashMap<>(); | ||
DefaultBoardPiece piece = DefaultBoardPiece.BLACK_ROOK_1; | ||
initialBoard.put(piece.getPosition(), piece.getInitialPiece()); | ||
return initialBoard; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package chess.domain.player; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
class PlayerTest { | ||
|
||
@Test | ||
void toggle() { | ||
assertThat(Player.WHITE.toggle()).isEqualTo(Player.BLACK); | ||
assertThat(Player.BLACK.toggle()).isEqualTo(Player.WHITE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package chess.domain.result; | ||
|
||
import chess.domain.board.Board; | ||
import chess.domain.board.DefaultBoardInitializer; | ||
import chess.domain.board.ManipulatedBoardInitializer; | ||
import chess.domain.player.Player; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
class StatusTest { | ||
private Board defaultBoard = Board.of(new DefaultBoardInitializer()); | ||
private Board manipulatedBoard = Board.of(new ManipulatedBoardInitializer()); | ||
|
||
@Test | ||
void create() { | ||
assertThat(Status.of(defaultBoard)) | ||
.isInstanceOf(Status.class); | ||
} | ||
|
||
@Test | ||
void defaultStatus() { | ||
assertThat(Status.of(defaultBoard).getStatus().get(Player.BLACK)).isEqualTo(38); | ||
assertThat(Status.of(defaultBoard).getStatus().get(Player.WHITE)).isEqualTo(38); | ||
} | ||
|
||
@Test | ||
void status() { | ||
assertThat(Status.of(manipulatedBoard).getStatus().get(Player.BLACK)).isEqualTo(5); | ||
assertThat(Status.of(manipulatedBoard).getStatus().get(Player.WHITE)).isEqualTo(0); | ||
} | ||
|
||
@Test | ||
void winner() { | ||
assertThat(Status.of(manipulatedBoard).getWinner()).isEqualTo(Player.BLACK); | ||
} | ||
} |