You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
750 B

package de.fd.fh.server.game;
import dev.morphia.Key;
import org.junit.jupiter.api.Test;
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
{
@Test
void testCreateGame()
{
final GameRepository repository = when(mock(GameRepository.class).save(any()))
.thenReturn(new Key<>(Game.class, "testCollection", GameId.of("98765")))
.getMock();
final Game game = new Game();
final GameId result = new GameService(repository).createGame(game);
assertNotNull(result);
assertEquals("98765", result.getIdentifier());
}
}