Files
NowChessSystems/.idea/copilotDiffState.xml
T

18 lines
22 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CopilotDiffPersistence">
<option name="pendingDiffs">
<map>
<entry key="$PROJECT_DIR$/modules/core/src/test/scala/de/nowchess/chess/resource/GameResourceIntegrationTest.scala">
<value>
<PendingDiffInfo>
<option name="filePath" value="$PROJECT_DIR$/modules/core/src/test/scala/de/nowchess/chess/resource/GameResourceIntegrationTest.scala" />
<option name="originalContent" value="package de.nowchess.chess.resource&#10;&#10;import de.nowchess.api.board.Square&#10;import de.nowchess.api.dto.*&#10;import de.nowchess.api.game.GameContext&#10;import de.nowchess.chess.client.CombinedExportResponse&#10;import de.nowchess.chess.exception.BadRequestException&#10;import de.nowchess.chess.grpc.{IoGrpcClientWrapper, RuleSetGrpcAdapter}&#10;import de.nowchess.io.fen.FenExporter&#10;import de.nowchess.io.pgn.{PgnExporter, PgnParser}&#10;import de.nowchess.rules.sets.DefaultRules&#10;import io.quarkus.test.InjectMock&#10;import io.quarkus.test.junit.QuarkusTest&#10;import jakarta.inject.Inject&#10;import org.eclipse.microprofile.jwt.JsonWebToken&#10;import org.junit.jupiter.api.{BeforeEach, DisplayName, Test}&#10;import org.junit.jupiter.api.Assertions.*&#10;import org.mockito.ArgumentMatchers.any&#10;import org.mockito.Mockito.when&#10;import org.mockito.invocation.InvocationOnMock&#10;&#10;import scala.compiletime.uninitialized&#10;&#10;// scalafix:off&#10;@QuarkusTest&#10;@DisplayName(&quot;GameResource Integration&quot;)&#10;class GameResourceIntegrationTest:&#10;&#10; @Inject&#10; var resource: GameResource = uninitialized&#10;&#10; @InjectMock&#10; var ruleAdapter: RuleSetGrpcAdapter = uninitialized&#10;&#10; @InjectMock&#10; var ioWrapper: IoGrpcClientWrapper = uninitialized&#10;&#10; @InjectMock&#10; var jwt: JsonWebToken = uninitialized&#10;&#10; @BeforeEach&#10; def setupMocks(): Unit =&#10; when(jwt.getClaim[Any](&quot;type&quot;)).thenReturn(&quot;bot&quot;)&#10;&#10; when(ioWrapper.importFen(any[String]())).thenReturn(GameContext.initial)&#10; when(ioWrapper.importPgn(any[String]())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; PgnParser.importGameContext(inv.getArgument[String](0)).getOrElse(GameContext.initial),&#10; )&#10; when(ioWrapper.exportCombined(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; val ctx = inv.getArgument[GameContext](0)&#10; CombinedExportResponse(FenExporter.exportGameContext(ctx), PgnExporter.exportGameContext(ctx)),&#10; )&#10; when(ioWrapper.exportFen(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; FenExporter.exportGameContext(inv.getArgument[GameContext](0)),&#10; )&#10; when(ioWrapper.exportPgn(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; PgnExporter.exportGameContext(inv.getArgument[GameContext](0)),&#10; )&#10;&#10; when(ruleAdapter.legalMoves(any())(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; DefaultRules.legalMoves(inv.getArgument[GameContext](0))(inv.getArgument[Square](1)),&#10; )&#10; when(ruleAdapter.allLegalMoves(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; DefaultRules.allLegalMoves(inv.getArgument[GameContext](0)),&#10; )&#10; when(ruleAdapter.applyMove(any())(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; DefaultRules.applyMove(inv.getArgument[GameContext](0))(inv.getArgument[de.nowchess.api.move.Move](1)),&#10; )&#10; when(ruleAdapter.isCheck(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; DefaultRules.isCheck(inv.getArgument[GameContext](0)),&#10; )&#10; when(ruleAdapter.isCheckmate(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; DefaultRules.isCheckmate(inv.getArgument[GameContext](0)),&#10; )&#10; when(ruleAdapter.isStalemate(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; DefaultRules.isStalemate(inv.getArgument[GameContext](0)),&#10; )&#10; when(ruleAdapter.isInsufficientMaterial(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; DefaultRules.isInsufficientMaterial(inv.getArgument[GameContext](0)),&#10; )&#10; when(ruleAdapter.isThreefoldRepetition(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; DefaultRules.isThreefoldRepetition(inv.getArgument[GameContext](0)),&#10; )&#10; when(ruleAdapter.postMoveStatus(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; DefaultRules.postMoveStatus(inv.getArgument[GameContext](0)),&#10; )&#10; when(ruleAdapter.candidateMoves(any())(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; DefaultRules.candidateMoves(inv.getArgument[GameContext](0))(inv.getArgument[Square](1)),&#10; )&#10; when(ruleAdapter.isFiftyMoveRule(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; DefaultRules.isFiftyMoveRule(inv.getArgument[GameContext](0)),&#10; )&#10;&#10; @Test&#10; @DisplayName(&quot;createGame returns 201&quot;)&#10; def testCreateGame(): Unit =&#10; val req = CreateGameRequestDto(None, None, None)&#10; val resp = resource.createGame(req)&#10; assertEquals(201, resp.getStatus)&#10; val dto = resp.getEntity.asInstanceOf[GameFullDto]&#10; assertNotNull(dto.gameId)&#10;&#10; @Test&#10; @DisplayName(&quot;getGame returns 200&quot;)&#10; def testGetGame(): Unit =&#10; val createResp = resource.createGame(CreateGameRequestDto(None, None, None))&#10; val gameId = createResp.getEntity.asInstanceOf[GameFullDto].gameId&#10; val getResp = resource.getGame(gameId)&#10; assertEquals(200, getResp.getStatus)&#10; val dto = getResp.getEntity.asInstanceOf[GameFullDto]&#10; assertEquals(gameId, dto.gameId)&#10;&#10; @Test&#10; @DisplayName(&quot;makeMove advances game&quot;)&#10; def testMakeMove(): Unit =&#10; val createResp = resource.createGame(CreateGameRequestDto(None, None, None))&#10; val gameId = createResp.getEntity.asInstanceOf[GameFullDto].gameId&#10; val moveResp = resource.makeMove(gameId, &quot;e2e4&quot;)&#10; assertEquals(200, moveResp.getStatus)&#10; val state = moveResp.getEntity.asInstanceOf[GameStateDto]&#10; assertEquals(&quot;black&quot;, state.turn)&#10;&#10; @Test&#10; @DisplayName(&quot;makeMove with invalid UCI throws&quot;)&#10; def testMakeMoveInvalid(): Unit =&#10; val createResp = resource.createGame(CreateGameRequestDto(None, None, None))&#10; val gameId = createResp.getEntity.asInstanceOf[GameFullDto].gameId&#10; assertThrows(classOf[BadRequestException], () =&gt; resource.makeMove(gameId, &quot;invalid&quot;))&#10;&#10; @Test&#10; @DisplayName(&quot;getLegalMoves returns moves&quot;)&#10; def testGetLegalMoves(): Unit =&#10; val createResp = resource.createGame(CreateGameRequestDto(None, None, None))&#10; val gameId = createResp.getEntity.asInstanceOf[GameFullDto].gameId&#10; val movesResp = resource.getLegalMoves(gameId, &quot;&quot;)&#10; assertEquals(200, movesResp.getStatus)&#10; val dto = movesResp.getEntity.asInstanceOf[LegalMovesResponseDto]&#10; assertFalse(dto.moves.isEmpty)&#10;&#10; @Test&#10; @DisplayName(&quot;resignGame updates state&quot;)&#10; def testResignGame(): Unit =&#10; val createResp = resource.createGame(CreateGameRequestDto(None, None, None))&#10; val gameId = createResp.getEntity.asInstanceOf[GameFullDto].gameId&#10; val resignResp = resource.resignGame(gameId)&#10; assertEquals(200, resignResp.getStatus)&#10; val getResp = resource.getGame(gameId)&#10; val state = getResp.getEntity.asInstanceOf[GameFullDto].state&#10; assertEquals(&quot;resign&quot;, state.status)&#10;&#10; @Test&#10; @DisplayName(&quot;undoMove reverts&quot;)&#10; def testUndoMove(): Unit =&#10; val createResp = resource.createGame(CreateGameRequestDto(None, None, None))&#10; val gameId = createResp.getEntity.asInstanceOf[GameFullDto].gameId&#10; resource.makeMove(gameId, &quot;e2e4&quot;)&#10; val undoResp = resource.undoMove(gameId)&#10; assertEquals(200, undoResp.getStatus)&#10; val state = undoResp.getEntity.asInstanceOf[GameStateDto]&#10; assertEquals(&quot;white&quot;, state.turn)&#10;&#10; @Test&#10; @DisplayName(&quot;redoMove restores&quot;)&#10; def testRedoMove(): Unit =&#10; val createResp = resource.createGame(CreateGameRequestDto(None, None, None))&#10; val gameId = createResp.getEntity.asInstanceOf[GameFullDto].gameId&#10; resource.makeMove(gameId, &quot;e2e4&quot;)&#10; resource.undoMove(gameId)&#10; val redoResp = resource.redoMove(gameId)&#10; assertEquals(200, redoResp.getStatus)&#10; val state = redoResp.getEntity.asInstanceOf[GameStateDto]&#10; assertEquals(&quot;black&quot;, state.turn)&#10;&#10; @Test&#10; @DisplayName(&quot;drawAction offer&quot;)&#10; def testDrawActionOffer(): Unit =&#10; val createResp = resource.createGame(CreateGameRequestDto(None, None, None))&#10; val gameId = createResp.getEntity.asInstanceOf[GameFullDto].gameId&#10; val resp = resource.drawAction(gameId, &quot;offer&quot;)&#10; assertEquals(200, resp.getStatus)&#10;&#10; @Test&#10; @DisplayName(&quot;drawAction accept&quot;)&#10; def testDrawActionAccept(): Unit =&#10; val createResp = resource.createGame(CreateGameRequestDto(None, None, None))&#10; val gameId = createResp.getEntity.asInstanceOf[GameFullDto].gameId&#10; resource.drawAction(gameId, &quot;offer&quot;)&#10; val resp = resource.drawAction(gameId, &quot;accept&quot;)&#10; assertEquals(200, resp.getStatus)&#10;&#10; @Test&#10; @DisplayName(&quot;importFen creates game&quot;)&#10; def testImportFen(): Unit =&#10; val fen = &quot;rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1&quot;&#10; val req = ImportFenRequestDto(fen, None, None, None)&#10; val resp = resource.importFen(req)&#10; assertEquals(201, resp.getStatus)&#10;&#10; @Test&#10; @DisplayName(&quot;importPgn creates game&quot;)&#10; def testImportPgn(): Unit =&#10; val req = ImportPgnRequestDto(&quot;1. e4 c5&quot;)&#10; val resp = resource.importPgn(req)&#10; assertEquals(201, resp.getStatus)&#10; val dto = resp.getEntity.asInstanceOf[GameFullDto]&#10; assertTrue(dto.state.moves.length &gt; 0)&#10;&#10; @Test&#10; @DisplayName(&quot;exportFen returns FEN&quot;)&#10; def testExportFen(): Unit =&#10; val createResp = resource.createGame(CreateGameRequestDto(None, None, None))&#10; val gameId = createResp.getEntity.asInstanceOf[GameFullDto].gameId&#10; val resp = resource.exportFen(gameId)&#10; assertEquals(200, resp.getStatus)&#10; assertTrue(resp.getEntity.asInstanceOf[String].contains(&quot;rnbqkbnr&quot;))&#10;&#10; @Test&#10; @DisplayName(&quot;exportPgn returns PGN&quot;)&#10; def testExportPgn(): Unit =&#10; val createResp = resource.createGame(CreateGameRequestDto(None, None, None))&#10; val gameId = createResp.getEntity.asInstanceOf[GameFullDto].gameId&#10; resource.makeMove(gameId, &quot;e2e4&quot;)&#10; val resp = resource.exportPgn(gameId)&#10; assertEquals(200, resp.getStatus)&#10;// scalafix:on&#10;" />
<option name="updatedContent" value="package de.nowchess.chess.resource&#10;&#10;import de.nowchess.api.board.Square&#10;import de.nowchess.api.dto.*&#10;import de.nowchess.api.game.GameContext&#10;import de.nowchess.chess.client.CombinedExportResponse&#10;import de.nowchess.chess.exception.BadRequestException&#10;import de.nowchess.chess.grpc.{IoGrpcClientWrapper, RuleSetGrpcAdapter}&#10;import de.nowchess.io.fen.FenExporter&#10;import de.nowchess.io.pgn.{PgnExporter, PgnParser}&#10;import de.nowchess.rules.sets.DefaultRules&#10;import io.quarkus.test.InjectMock&#10;import io.quarkus.test.junit.QuarkusTest&#10;import jakarta.inject.Inject&#10;import org.eclipse.microprofile.jwt.JsonWebToken&#10;import org.junit.jupiter.api.{BeforeEach, DisplayName, Test}&#10;import org.junit.jupiter.api.Assertions.*&#10;import org.mockito.ArgumentMatchers.any&#10;import org.mockito.Mockito.when&#10;import org.mockito.invocation.InvocationOnMock&#10;&#10;import scala.compiletime.uninitialized&#10;&#10;// scalafix:off&#10;@QuarkusTest&#10;@DisplayName(&quot;GameResource Integration&quot;)&#10;class GameResourceIntegrationTest:&#10;&#10; @Inject&#10; var resource: GameResource = uninitialized&#10;&#10; @InjectMock&#10; var ruleAdapter: RuleSetGrpcAdapter = uninitialized&#10;&#10; @InjectMock&#10; var ioWrapper: IoGrpcClientWrapper = uninitialized&#10;&#10; @InjectMock&#10; var jwt: JsonWebToken = uninitialized&#10;&#10; @BeforeEach&#10; def setupMocks(): Unit =&#10; when(jwt.getClaim[AnyRef](&quot;type&quot;)).thenReturn(&quot;bot&quot;)&#10;&#10; when(ioWrapper.importFen(any[String]())).thenReturn(GameContext.initial)&#10; when(ioWrapper.importPgn(any[String]())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; PgnParser.importGameContext(inv.getArgument[String](0)).getOrElse(GameContext.initial),&#10; )&#10; when(ioWrapper.exportCombined(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; val ctx = inv.getArgument[GameContext](0)&#10; CombinedExportResponse(FenExporter.exportGameContext(ctx), PgnExporter.exportGameContext(ctx)),&#10; )&#10; when(ioWrapper.exportFen(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; FenExporter.exportGameContext(inv.getArgument[GameContext](0)),&#10; )&#10; when(ioWrapper.exportPgn(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; PgnExporter.exportGameContext(inv.getArgument[GameContext](0)),&#10; )&#10;&#10; when(ruleAdapter.legalMoves(any())(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; DefaultRules.legalMoves(inv.getArgument[GameContext](0))(inv.getArgument[Square](1)),&#10; )&#10; when(ruleAdapter.allLegalMoves(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; DefaultRules.allLegalMoves(inv.getArgument[GameContext](0)),&#10; )&#10; when(ruleAdapter.applyMove(any())(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; DefaultRules.applyMove(inv.getArgument[GameContext](0))(inv.getArgument[de.nowchess.api.move.Move](1)),&#10; )&#10; when(ruleAdapter.isCheck(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; DefaultRules.isCheck(inv.getArgument[GameContext](0)),&#10; )&#10; when(ruleAdapter.isCheckmate(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; DefaultRules.isCheckmate(inv.getArgument[GameContext](0)),&#10; )&#10; when(ruleAdapter.isStalemate(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; DefaultRules.isStalemate(inv.getArgument[GameContext](0)),&#10; )&#10; when(ruleAdapter.isInsufficientMaterial(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; DefaultRules.isInsufficientMaterial(inv.getArgument[GameContext](0)),&#10; )&#10; when(ruleAdapter.isThreefoldRepetition(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; DefaultRules.isThreefoldRepetition(inv.getArgument[GameContext](0)),&#10; )&#10; when(ruleAdapter.postMoveStatus(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; DefaultRules.postMoveStatus(inv.getArgument[GameContext](0)),&#10; )&#10; when(ruleAdapter.candidateMoves(any())(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; DefaultRules.candidateMoves(inv.getArgument[GameContext](0))(inv.getArgument[Square](1)),&#10; )&#10; when(ruleAdapter.isFiftyMoveRule(any())).thenAnswer((inv: InvocationOnMock) =&gt;&#10; DefaultRules.isFiftyMoveRule(inv.getArgument[GameContext](0)),&#10; )&#10;&#10; @Test&#10; @DisplayName(&quot;createGame returns 201&quot;)&#10; def testCreateGame(): Unit =&#10; val req = CreateGameRequestDto(None, None, None)&#10; val resp = resource.createGame(req)&#10; assertEquals(201, resp.getStatus)&#10; val dto = resp.getEntity.asInstanceOf[GameFullDto]&#10; assertNotNull(dto.gameId)&#10;&#10; @Test&#10; @DisplayName(&quot;getGame returns 200&quot;)&#10; def testGetGame(): Unit =&#10; val createResp = resource.createGame(CreateGameRequestDto(None, None, None))&#10; val gameId = createResp.getEntity.asInstanceOf[GameFullDto].gameId&#10; val getResp = resource.getGame(gameId)&#10; assertEquals(200, getResp.getStatus)&#10; val dto = getResp.getEntity.asInstanceOf[GameFullDto]&#10; assertEquals(gameId, dto.gameId)&#10;&#10; @Test&#10; @DisplayName(&quot;makeMove advances game&quot;)&#10; def testMakeMove(): Unit =&#10; val createResp = resource.createGame(CreateGameRequestDto(None, None, None))&#10; val gameId = createResp.getEntity.asInstanceOf[GameFullDto].gameId&#10; val moveResp = resource.makeMove(gameId, &quot;e2e4&quot;)&#10; assertEquals(200, moveResp.getStatus)&#10; val state = moveResp.getEntity.asInstanceOf[GameStateDto]&#10; assertEquals(&quot;black&quot;, state.turn)&#10;&#10; @Test&#10; @DisplayName(&quot;makeMove with invalid UCI throws&quot;)&#10; def testMakeMoveInvalid(): Unit =&#10; val createResp = resource.createGame(CreateGameRequestDto(None, None, None))&#10; val gameId = createResp.getEntity.asInstanceOf[GameFullDto].gameId&#10; assertThrows(classOf[BadRequestException], () =&gt; resource.makeMove(gameId, &quot;invalid&quot;))&#10;&#10; @Test&#10; @DisplayName(&quot;getLegalMoves returns moves&quot;)&#10; def testGetLegalMoves(): Unit =&#10; val createResp = resource.createGame(CreateGameRequestDto(None, None, None))&#10; val gameId = createResp.getEntity.asInstanceOf[GameFullDto].gameId&#10; val movesResp = resource.getLegalMoves(gameId, &quot;&quot;)&#10; assertEquals(200, movesResp.getStatus)&#10; val dto = movesResp.getEntity.asInstanceOf[LegalMovesResponseDto]&#10; assertFalse(dto.moves.isEmpty)&#10;&#10; @Test&#10; @DisplayName(&quot;resignGame updates state&quot;)&#10; def testResignGame(): Unit =&#10; val createResp = resource.createGame(CreateGameRequestDto(None, None, None))&#10; val gameId = createResp.getEntity.asInstanceOf[GameFullDto].gameId&#10; val resignResp = resource.resignGame(gameId)&#10; assertEquals(200, resignResp.getStatus)&#10; val getResp = resource.getGame(gameId)&#10; val state = getResp.getEntity.asInstanceOf[GameFullDto].state&#10; assertEquals(&quot;resign&quot;, state.status)&#10;&#10; @Test&#10; @DisplayName(&quot;undoMove reverts&quot;)&#10; def testUndoMove(): Unit =&#10; val createResp = resource.createGame(CreateGameRequestDto(None, None, None))&#10; val gameId = createResp.getEntity.asInstanceOf[GameFullDto].gameId&#10; resource.makeMove(gameId, &quot;e2e4&quot;)&#10; val undoResp = resource.undoMove(gameId)&#10; assertEquals(200, undoResp.getStatus)&#10; val state = undoResp.getEntity.asInstanceOf[GameStateDto]&#10; assertEquals(&quot;white&quot;, state.turn)&#10;&#10; @Test&#10; @DisplayName(&quot;redoMove restores&quot;)&#10; def testRedoMove(): Unit =&#10; val createResp = resource.createGame(CreateGameRequestDto(None, None, None))&#10; val gameId = createResp.getEntity.asInstanceOf[GameFullDto].gameId&#10; resource.makeMove(gameId, &quot;e2e4&quot;)&#10; resource.undoMove(gameId)&#10; val redoResp = resource.redoMove(gameId)&#10; assertEquals(200, redoResp.getStatus)&#10; val state = redoResp.getEntity.asInstanceOf[GameStateDto]&#10; assertEquals(&quot;black&quot;, state.turn)&#10;&#10; @Test&#10; @DisplayName(&quot;drawAction offer&quot;)&#10; def testDrawActionOffer(): Unit =&#10; val createResp = resource.createGame(CreateGameRequestDto(None, None, None))&#10; val gameId = createResp.getEntity.asInstanceOf[GameFullDto].gameId&#10; val resp = resource.drawAction(gameId, &quot;offer&quot;)&#10; assertEquals(200, resp.getStatus)&#10;&#10; @Test&#10; @DisplayName(&quot;drawAction accept&quot;)&#10; def testDrawActionAccept(): Unit =&#10; val createResp = resource.createGame(CreateGameRequestDto(None, None, None))&#10; val gameId = createResp.getEntity.asInstanceOf[GameFullDto].gameId&#10; resource.drawAction(gameId, &quot;offer&quot;)&#10; val resp = resource.drawAction(gameId, &quot;accept&quot;)&#10; assertEquals(200, resp.getStatus)&#10;&#10; @Test&#10; @DisplayName(&quot;importFen creates game&quot;)&#10; def testImportFen(): Unit =&#10; val fen = &quot;rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1&quot;&#10; val req = ImportFenRequestDto(fen, None, None, None)&#10; val resp = resource.importFen(req)&#10; assertEquals(201, resp.getStatus)&#10;&#10; @Test&#10; @DisplayName(&quot;importPgn creates game&quot;)&#10; def testImportPgn(): Unit =&#10; val req = ImportPgnRequestDto(&quot;1. e4 c5&quot;)&#10; val resp = resource.importPgn(req)&#10; assertEquals(201, resp.getStatus)&#10; val dto = resp.getEntity.asInstanceOf[GameFullDto]&#10; assertTrue(dto.state.moves.length &gt; 0)&#10;&#10; @Test&#10; @DisplayName(&quot;exportFen returns FEN&quot;)&#10; def testExportFen(): Unit =&#10; val createResp = resource.createGame(CreateGameRequestDto(None, None, None))&#10; val gameId = createResp.getEntity.asInstanceOf[GameFullDto].gameId&#10; val resp = resource.exportFen(gameId)&#10; assertEquals(200, resp.getStatus)&#10; assertTrue(resp.getEntity.asInstanceOf[String].contains(&quot;rnbqkbnr&quot;))&#10;&#10; @Test&#10; @DisplayName(&quot;exportPgn returns PGN&quot;)&#10; def testExportPgn(): Unit =&#10; val createResp = resource.createGame(CreateGameRequestDto(None, None, None))&#10; val gameId = createResp.getEntity.asInstanceOf[GameFullDto].gameId&#10; resource.makeMove(gameId, &quot;e2e4&quot;)&#10; val resp = resource.exportPgn(gameId)&#10; assertEquals(200, resp.getStatus)&#10;// scalafix:on&#10;" />
</PendingDiffInfo>
</value>
</entry>
</map>
</option>
</component>
</project>