|
|
@ -5,6 +5,8 @@ import dev.morphia.Key; |
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
import org.mockito.ArgumentCaptor; |
|
|
|
|
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
|
import static org.mockito.ArgumentMatchers.any; |
|
|
|
import static org.mockito.BDDMockito.then; |
|
|
@ -54,6 +56,15 @@ class GameServiceTest |
|
|
|
assertEquals("98765", savedGame.getCurrentPlayer().getIdentifier()); |
|
|
|
assertEquals(64, savedGame.getFields().size()); |
|
|
|
|
|
|
|
final Set<Field> fields = savedGame.getFields(); |
|
|
|
|
|
|
|
fields.forEach(field -> { |
|
|
|
|
|
|
|
final Field.Color expected = (field.getX() + field.getY()) % 2 != 1 ? Field.Color.WHITE : Field.Color.BLACK; |
|
|
|
|
|
|
|
assertEquals(expected, field.getColor()); |
|
|
|
}); |
|
|
|
|
|
|
|
then(repository).should().save(any(Game.class)); |
|
|
|
then(repository).shouldHaveNoMoreInteractions(); |
|
|
|
} |