You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am developing a Quarkus Kubernetes operator that is interacting with AWS through the AWS SDK for Java and I'm using mockk in my unit and integration tests.
One of the cases that I need to mock are calls to AWS SDK's paginators, for example: organizationsClient.listAccountsPaginator() where organizationsClient is an OrganizationsAsyncClient.
In my unit tests I create the mock via the @MockK annotation and the mocking is fairly straightfoward:
every { organizationsClient.listAccountsPaginator() } answers { callOriginal() }
every { organizationsClient.listAccounts(any<ListAccountsRequest>()) } returns CompletableFuture.completedFuture(ListAccountsResponse.builder().accounts(account).build())
In my integration tests (which are @QuarkusTests), if I use @InjectMock and mock the paginator calls in the same way, I get exceptions of the following kind:
io.mockk.MockKException: no answer found for: AwsClientBean_ProducerMethod_organizationsClient_162d3fc8f8a3dacbf06a8e602ca1d5cf033cb60b_ClientProxy(#1).arc$delegate()
However, if I create a bean that replaces the original bean and create my mock with mockk() my mocks are working as expected:
Thanks @Obirah for reporting this. Do you have a minimal project setup that reproduce the error ?
It doesn't looks like, but do you use co-routine in your application ?
I am developing a Quarkus Kubernetes operator that is interacting with AWS through the AWS SDK for Java and I'm using mockk in my unit and integration tests.
One of the cases that I need to mock are calls to AWS SDK's paginators, for example:
organizationsClient.listAccountsPaginator()
where organizationsClient is anOrganizationsAsyncClient
.In my unit tests I create the mock via the
@MockK
annotation and the mocking is fairly straightfoward:In my integration tests (which are
@QuarkusTest
s), if I use@InjectMock
and mock the paginator calls in the same way, I get exceptions of the following kind:However, if I create a bean that replaces the original bean and create my mock with
mockk()
my mocks are working as expected:The text was updated successfully, but these errors were encountered: