|
@ -71,4 +71,27 @@ class GameRepositoryTest |
|
|
assertNotNull(result.getId()); |
|
|
assertNotNull(result.getId()); |
|
|
assertEquals(2, result.getFields().size()); |
|
|
assertEquals(2, result.getFields().size()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void findByGameIdTest() |
|
|
|
|
|
{ |
|
|
|
|
|
final Set<Field> fields = new HashSet<>(); |
|
|
|
|
|
fields.add(new Field(0, 0, Field.Color.BLACK, new Figure(Figure.Type.BISHOP, UserId.of("12345")))); |
|
|
|
|
|
fields.add(new Field(0, 2, Field.Color.WHITE, new Figure(Figure.Type.BISHOP, UserId.of("98765")))); |
|
|
|
|
|
|
|
|
|
|
|
final Game game = new Game(GameId.of("4242"), UserId.of("12345"), UserId.of("98765"), UserId.of("12345"), fields, UserId.of("12345")); |
|
|
|
|
|
|
|
|
|
|
|
ds.save(game); |
|
|
|
|
|
|
|
|
|
|
|
final Game result = repository.findByGameId(GameId.of("4242")); |
|
|
|
|
|
|
|
|
|
|
|
assertNotNull(result); |
|
|
|
|
|
assertEquals("12345", result.getWhitePlayer().getIdentifier()); |
|
|
|
|
|
assertEquals("12345", result.getCurrentPlayer().getIdentifier()); |
|
|
|
|
|
assertEquals("98765", result.getBlackPlayer().getIdentifier()); |
|
|
|
|
|
assertEquals("12345", result.getWinner().getIdentifier()); |
|
|
|
|
|
assertNotNull(result.getId()); |
|
|
|
|
|
assertEquals(2, result.getFields().size()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |