简体   繁体   中英

Mocking LambdaAsyncClient invoke AWS SDK2 in Java

I wondering if there is a way to mock the amazon LambdaAsyncClient without implementing a new client just for test purposes. I have java code in my service that call AWS lambda, I created a wrapper client which is none blocking and waiting for a callback:

import software.amazon.awssdk.services.lambda.LambdaAsyncClient
...
private LambdaAsyncClient lambdaAsyncClient;
...

CompletableFuture<InvokeResponse> lambdaCompletableFuture = lambdaAsyncClient.invoke(invokeRequest).whenCompleteAsync(callBack);

appreciate your help.

The code is using AWS SDK2 which has no configuration of API target, in our sanity test how can I test my code without the dependency of real lambda call

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM