Browse Source

setup new createGame-Test

feat-serverGameRepresentation
Steffen Nitschke 4 years ago
parent
commit
5ae590793e
  1. 17
      fh.fd.ci.server/src/test/java/de/fd/fh/server/game/GameServiceTest.java

17
fh.fd.ci.server/src/test/java/de/fd/fh/server/game/GameServiceTest.java

@ -1,7 +1,9 @@
package de.fd.fh.server.game; package de.fd.fh.server.game;
import de.fd.fh.server.user.UserId;
import dev.morphia.Key; import dev.morphia.Key;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
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;
@ -24,4 +26,19 @@ class GameServiceTest
assertNotNull(result); assertNotNull(result);
assertEquals("98765", result.getIdentifier()); assertEquals("98765", result.getIdentifier());
} }
@Test
void given_twoUserIds_when_initGame_should_initGame()
{
final UserId blackPlayer = UserId.of("12345");
final UserId whitePlayer = UserId.of("98765");
final GameRepository repository = when(mock(GameRepository.class).save(any()))
.thenReturn(new Key<>(Game.class, "testCollection", GameId.of("4242")))
.getMock();
final ArgumentCaptor<Game> captor = ArgumentCaptor.forClass(Game.class);
final GameId result = new GameService(repository).createGame(blackPlayer, whitePlayer);
}
} }
Loading…
Cancel
Save