From 71d98d3d02a067ec6b046cde269ea47158146317 Mon Sep 17 00:00:00 2001 From: Pavel Salamon Date: Mon, 27 May 2024 15:54:05 +0200 Subject: [PATCH] fix tests --- .../test/scala/za/co/absa/atum/server/api/TestData.scala | 2 ++ .../api/http/CreateCheckpointEndpointIntegrationTests.scala | 4 ++-- .../http/CreatePartitioningEndpointIntegrationTests.scala | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/server/src/test/scala/za/co/absa/atum/server/api/TestData.scala b/server/src/test/scala/za/co/absa/atum/server/api/TestData.scala index 4e8f84500..1dab29abd 100644 --- a/server/src/test/scala/za/co/absa/atum/server/api/TestData.scala +++ b/server/src/test/scala/za/co/absa/atum/server/api/TestData.scala @@ -22,6 +22,8 @@ import java.util.UUID trait TestData { + protected val uuid = UUID.randomUUID() + // Partitioning DTO protected val partitioningDTO1: PartitioningDTO = Seq( PartitionDTO("key1", "val1"), diff --git a/server/src/test/scala/za/co/absa/atum/server/api/http/CreateCheckpointEndpointIntegrationTests.scala b/server/src/test/scala/za/co/absa/atum/server/api/http/CreateCheckpointEndpointIntegrationTests.scala index 65cfe763f..6568ae944 100644 --- a/server/src/test/scala/za/co/absa/atum/server/api/http/CreateCheckpointEndpointIntegrationTests.scala +++ b/server/src/test/scala/za/co/absa/atum/server/api/http/CreateCheckpointEndpointIntegrationTests.scala @@ -38,7 +38,7 @@ object CreateCheckpointEndpointIntegrationTests extends ZIOSpecDefault with Endp private val checkpointControllerMock = mock(classOf[CheckpointController]) when(checkpointControllerMock.createCheckpointV2(checkpointDTO1)) - .thenReturn(ZIO.succeed(SingleSuccessResponse(checkpointDTO1))) + .thenReturn(ZIO.succeed(SingleSuccessResponse(checkpointDTO1, uuid))) when(checkpointControllerMock.createCheckpointV2(checkpointDTO2)) .thenReturn(ZIO.fail(GeneralErrorResponse("error"))) when(checkpointControllerMock.createCheckpointV2(checkpointDTO3)) @@ -68,7 +68,7 @@ object CreateCheckpointEndpointIntegrationTests extends ZIOSpecDefault with Endp val body = response.map(_.body) val statusCode = response.map(_.code) - assertZIO(body <&> statusCode)(equalTo(Right(SingleSuccessResponse(checkpointDTO1)), StatusCode.Created)) + assertZIO(body <&> statusCode)(equalTo(Right(SingleSuccessResponse(checkpointDTO1, uuid)), StatusCode.Created)) }, test("Returns expected BadRequest") { val response = request diff --git a/server/src/test/scala/za/co/absa/atum/server/api/http/CreatePartitioningEndpointIntegrationTests.scala b/server/src/test/scala/za/co/absa/atum/server/api/http/CreatePartitioningEndpointIntegrationTests.scala index 816bddfbc..9e4d60484 100644 --- a/server/src/test/scala/za/co/absa/atum/server/api/http/CreatePartitioningEndpointIntegrationTests.scala +++ b/server/src/test/scala/za/co/absa/atum/server/api/http/CreatePartitioningEndpointIntegrationTests.scala @@ -33,12 +33,14 @@ import zio._ import zio.test.Assertion.equalTo import zio.test._ +import java.util.UUID + object CreatePartitioningEndpointIntegrationTests extends ZIOSpecDefault with Endpoints with TestData { private val createPartitioningEndpointMock = mock(classOf[PartitioningController]) when(createPartitioningEndpointMock.createPartitioningIfNotExistsV2(partitioningSubmitDTO1)) - .thenReturn(ZIO.succeed(SingleSuccessResponse(createAtumContextDTO(partitioningSubmitDTO1)))) + .thenReturn(ZIO.succeed(SingleSuccessResponse(createAtumContextDTO(partitioningSubmitDTO1), uuid))) when(createPartitioningEndpointMock.createPartitioningIfNotExistsV2(partitioningSubmitDTO2)) .thenReturn(ZIO.fail(GeneralErrorResponse("error"))) when(createPartitioningEndpointMock.createPartitioningIfNotExistsV2(partitioningSubmitDTO3)) @@ -69,7 +71,7 @@ object CreatePartitioningEndpointIntegrationTests extends ZIOSpecDefault with En val statusCode = response.map(_.code) assertZIO(body <&> statusCode)( - equalTo(Right(SingleSuccessResponse(createAtumContextDTO(partitioningSubmitDTO1))), StatusCode.Ok) + equalTo(Right(SingleSuccessResponse(createAtumContextDTO(partitioningSubmitDTO1), uuid)), StatusCode.Ok) ) }, test("Returns expected BadRequest") {