Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
salamonpavel committed May 27, 2024
1 parent dfc3a4f commit 71d98d3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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") {
Expand Down

0 comments on commit 71d98d3

Please sign in to comment.