Skip to content

Commit

Permalink
Debug failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
lealobanov committed Nov 21, 2024
1 parent 2d02e32 commit 99f39fc
Showing 1 changed file with 28 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -475,19 +475,42 @@ class AsyncFlowAccessApiImplTest {

@Test
fun `test getSystemTransactionResult`() {
val flowTransactionResult = FlowTransactionResult(FlowTransactionStatus.SEALED, 1, "message", emptyList(), flowId, HEIGHT, flowId, flowId, 1L)
val flowTransactionResult = FlowTransactionResult(
FlowTransactionStatus.SEALED,
1,
"message",
emptyList(),
flowId,
HEIGHT,
flowId,
flowId,
1L
)

val successFlowId = FlowId.of("id_success".toByteArray())
val successRequest = Access.GetSystemTransactionResultRequest
.newBuilder()
.setBlockId(successFlowId.byteStringValue)
.build()

`when`(api.getSystemTransactionResult(any())).thenReturn(setupFutureMock(MockResponseFactory.transactionResultResponse()))
`when`(api.getSystemTransactionResult(eq(successRequest)))
.thenReturn(setupFutureMock(MockResponseFactory.transactionResultResponse()))

val result = asyncFlowAccessApi.getSystemTransactionResult(flowId).get()
val result = asyncFlowAccessApi.getSystemTransactionResult(successFlowId).get()
assertSuccess(result, flowTransactionResult)
}

@Test
fun `test getSystemTransactionResult failure`() {
`when`(api.getSystemTransactionResult(any())).thenThrow(testException)
val failureFlowId = FlowId.of("id_failure".toByteArray())
val failureRequest = Access.GetSystemTransactionResultRequest
.newBuilder()
.setBlockId(failureFlowId.byteStringValue)
.build()

`when`(api.getSystemTransactionResult(eq(failureRequest))).thenThrow(testException)

val result = asyncFlowAccessApi.getSystemTransactionResult(flowId).get()
val result = asyncFlowAccessApi.getSystemTransactionResult(failureFlowId).get()
assertFailure(result, "Failed to get system transaction result by block ID", testException)
}

Expand Down

0 comments on commit 99f39fc

Please sign in to comment.