Skip to content

Commit

Permalink
WIP: continue with code duplication changes
Browse files Browse the repository at this point in the history
  • Loading branch information
lealobanov committed Oct 30, 2024
1 parent 0a8e1c9 commit 369c4d4
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.ArgumentMatchers.any
import org.mockito.Mockito.*
import org.onflow.flow.sdk.impl.AsyncFlowAccessApiImplTest.Companion.testException
import org.onflow.protobuf.access.Access
import org.onflow.protobuf.access.AccessAPIGrpc
import org.onflow.protobuf.entities.*
Expand Down Expand Up @@ -898,10 +899,9 @@ class FlowAccessApiImplTest {
@Test
fun `Test subscribeExecutionDataByBlockHeight error case`() = runTest {
val blockHeight = 100L
val exception = RuntimeException("Test exception")

`when`(mockExecutionDataApi.subscribeExecutionDataFromStartBlockHeight(any()))
.thenAnswer { throw exception }
.thenAnswer { throw testException }

val (_, errorChannel) = flowAccessApiImpl.subscribeExecutionDataByBlockHeight(this, blockHeight)

Expand All @@ -913,7 +913,7 @@ class FlowAccessApiImplTest {
job.join()

if (receivedException != null) {
assertEquals(exception.message, receivedException!!.message)
assertEquals(testException.message, receivedException!!.message)
} else {
fail("Expected error but got success")
}
Expand Down

0 comments on commit 369c4d4

Please sign in to comment.