diff --git a/modules/core/src/test/resources/application.yml b/modules/core/src/test/resources/application.yml index af2dd01..e182fce 100644 --- a/modules/core/src/test/resources/application.yml +++ b/modules/core/src/test/resources/application.yml @@ -18,6 +18,8 @@ nowchess: enabled: false coordinator: enabled: false + game-creation-stream: + enabled: false redis: host: localhost port: 6379 diff --git a/modules/core/src/test/scala/de/nowchess/chess/service/GameCreationServiceTest.scala b/modules/core/src/test/scala/de/nowchess/chess/service/GameCreationServiceTest.scala index e1b0778..2fbd6e2 100644 --- a/modules/core/src/test/scala/de/nowchess/chess/service/GameCreationServiceTest.scala +++ b/modules/core/src/test/scala/de/nowchess/chess/service/GameCreationServiceTest.scala @@ -3,13 +3,16 @@ package de.nowchess.chess.service import de.nowchess.api.dto.{GameCreationRequestDto, PlayerInfoDto, TimeControlDto} import de.nowchess.api.game.{GameMode, TimeControl} import de.nowchess.api.player.PlayerType +import de.nowchess.chess.client.CombinedExportResponse +import de.nowchess.chess.grpc.IoGrpcClientWrapper import de.nowchess.chess.redis.GameRedisSubscriberManager import io.quarkus.test.InjectMock import io.quarkus.test.junit.QuarkusTest import jakarta.inject.Inject import org.junit.jupiter.api.Assertions.* -import org.junit.jupiter.api.{DisplayName, Test} -import org.mockito.Mockito.verify +import org.junit.jupiter.api.{BeforeEach, DisplayName, Test} +import org.mockito.ArgumentMatchers.any +import org.mockito.Mockito.{verify, when} import scala.compiletime.uninitialized // scalafix:off @@ -23,6 +26,14 @@ class GameCreationServiceTest: @InjectMock var subscriberManager: GameRedisSubscriberManager = uninitialized + @InjectMock + var ioWrapper: IoGrpcClientWrapper = uninitialized + + @BeforeEach + def setup(): Unit = + when(ioWrapper.exportCombined(any())) + .thenReturn(CombinedExportResponse("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", "")) + private def player(id: String, name: String): PlayerInfoDto = PlayerInfoDto(id, name, PlayerType.Human)