Skip to content

Commit 0237f13

Browse files
committed
fix tests
1 parent 1dadc6b commit 0237f13

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

src/main/java/com/bernd/model/GameBuilder.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ public final class GameBuilder {
66
private int state;
77
private int[][] board;
88
private int[] forbidden;
9+
private long updated = System.currentTimeMillis();
910

1011
private GameBuilder(Game game) {
1112
this.game = game;
@@ -30,6 +31,11 @@ public GameBuilder withForbidden(int x, int y) {
3031
return withForbidden(new int[]{x, y});
3132
}
3233

34+
GameBuilder withUpdated(long updated) {
35+
this.updated = updated;
36+
return this;
37+
}
38+
3339
static GameBuilder builder(Game game) {
3440
GameBuilder builder = new GameBuilder(game);
3541
builder.state = game.state();
@@ -47,7 +53,7 @@ public Game build() {
4753
board,
4854
game.dim(),
4955
game.timesetting(),
50-
System.currentTimeMillis(),
56+
updated,
5157
game.handicap(),
5258
forbidden,
5359
game.moves()

src/test/java/com/bernd/model/GameBuilderTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ void unchanged() {
1414
"123",
1515
"bernd",
1616
"heike",
17-
true,
17+
1,
1818
createEmptyBoard(9),
1919
9,
20-
2,
20+
10,
21+
1727532679000L,
2122
0,
2223
new int[]{-1, -1},
2324
MoveList.create(2));
24-
Game game2 = GameBuilder.builder(game).build();
25+
Game game2 = GameBuilder.builder(game).withUpdated(game.updated()).build();
2526
assertEquals(game, game2);
2627
}
2728
}

src/test/java/com/bernd/util/SgfCreatorTest.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,18 @@ void testCreate() {
1717
MoveList moveList = MoveList.create(20);
1818
moveList.add(new Move(Board.B, 0, null, 3, 4));
1919
moveList.add(new Move(Board.W, 0, null, 6, 4));
20-
Game game = new Game("1234", "B", "W", false, new int[9][], 9, 0, 0, new int[]{-1, -1}, moveList);
20+
Game game = new Game(
21+
"1234",
22+
"B",
23+
"W",
24+
1,
25+
new int[9][],
26+
9,
27+
10,
28+
1727532679000L,
29+
0,
30+
new int[]{-1, -1},
31+
moveList);
2132
String sgf = SgfCreator.createSgf(game, LocalDate.of(2024, Month.AUGUST, 30));
2233
assertEquals("(;FF[4]CA[UTF-8]GM[1]DT[2024-08-30]GN[1234]PB[B]PW[W]RE[?]SZ[9];B[de];W[ge])",
2334
sgf.replace("\n", ""));

0 commit comments

Comments
 (0)