|
@ -5,6 +5,7 @@ import dev.morphia.Key; |
|
|
import org.junit.jupiter.api.Test; |
|
|
import org.junit.jupiter.api.Test; |
|
|
import org.mockito.ArgumentCaptor; |
|
|
import org.mockito.ArgumentCaptor; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.List; |
|
|
import java.util.Set; |
|
|
import java.util.Set; |
|
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
@ -89,4 +90,18 @@ class GameServiceTest |
|
|
|
|
|
|
|
|
assertNotNull(result); |
|
|
assertNotNull(result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void given_storedGames_when_findGamesOfUser_should_returnSetOfGames() |
|
|
|
|
|
{ |
|
|
|
|
|
final GameRepository repository = when(mock(GameRepository.class).findRunningGamesOfPlayer(any(UserId.class))) |
|
|
|
|
|
.thenReturn(List.of( |
|
|
|
|
|
new Game(GameId.random(), UserId.of("12345"), UserId.random(), null, null, null), |
|
|
|
|
|
new Game(GameId.random(), UserId.random(), UserId.of("12345"), null, null, null))) |
|
|
|
|
|
.getMock(); |
|
|
|
|
|
|
|
|
|
|
|
final List<Game> result = new GameService(repository).findRunningGamesOfUser(UserId.of("12345")); |
|
|
|
|
|
|
|
|
|
|
|
assertEquals(2, result.size()); |
|
|
|
|
|
} |
|
|
} |
|
|
} |