|
@ -7,8 +7,8 @@ import org.mockito.ArgumentCaptor; |
|
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
import static org.mockito.ArgumentMatchers.any; |
|
|
import static org.mockito.ArgumentMatchers.any; |
|
|
import static org.mockito.Mockito.mock; |
|
|
|
|
|
import static org.mockito.Mockito.when; |
|
|
|
|
|
|
|
|
import static org.mockito.BDDMockito.then; |
|
|
|
|
|
import static org.mockito.Mockito.*; |
|
|
|
|
|
|
|
|
class GameServiceTest |
|
|
class GameServiceTest |
|
|
{ |
|
|
{ |
|
@ -40,5 +40,14 @@ class GameServiceTest |
|
|
final ArgumentCaptor<Game> captor = ArgumentCaptor.forClass(Game.class); |
|
|
final ArgumentCaptor<Game> captor = ArgumentCaptor.forClass(Game.class); |
|
|
|
|
|
|
|
|
final GameId result = new GameService(repository).createGame(blackPlayer, whitePlayer); |
|
|
final GameId result = new GameService(repository).createGame(blackPlayer, whitePlayer); |
|
|
|
|
|
|
|
|
|
|
|
verify(repository).save(captor.capture()); |
|
|
|
|
|
|
|
|
|
|
|
assertEquals("4242", result.getIdentifier()); |
|
|
|
|
|
|
|
|
|
|
|
assertNotNull(captor.getValue()); |
|
|
|
|
|
|
|
|
|
|
|
then(repository).should().save(any(Game.class)); |
|
|
|
|
|
then(repository).shouldHaveNoMoreInteractions(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |