|
@ -1,17 +1,25 @@ |
|
|
package de.fd.fh.server.game; |
|
|
package de.fd.fh.server.game; |
|
|
|
|
|
|
|
|
|
|
|
import dev.morphia.Key; |
|
|
import org.junit.jupiter.api.Test; |
|
|
import org.junit.jupiter.api.Test; |
|
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
|
|
|
import static org.mockito.ArgumentMatchers.any; |
|
|
|
|
|
import static org.mockito.Mockito.mock; |
|
|
|
|
|
import static org.mockito.Mockito.when; |
|
|
|
|
|
|
|
|
class GameServiceTest |
|
|
class GameServiceTest |
|
|
{ |
|
|
{ |
|
|
@Test |
|
|
@Test |
|
|
void testCreateGame() |
|
|
void testCreateGame() |
|
|
{ |
|
|
{ |
|
|
|
|
|
final GameRepository repository = when(mock(GameRepository.class).save(any())) |
|
|
|
|
|
.thenReturn(new Key<>(Game.class, "testCollection", GameId.random())) |
|
|
|
|
|
.getMock(); |
|
|
|
|
|
|
|
|
final Game game = new Game(); |
|
|
final Game game = new Game(); |
|
|
|
|
|
|
|
|
final Game result = new GameService().createGame(); |
|
|
|
|
|
|
|
|
final GameId result = new GameService(repository).createGame(game); |
|
|
|
|
|
|
|
|
assertNotNull(result); |
|
|
assertNotNull(result); |
|
|
} |
|
|
} |