WCY
WCY

Reputation: 327

how to unit test aws lambda with SQS Event

I am implementing a AWS Lambda that gets triggered from SQS, and then do some other thing. This is my current Handler:

how I can pass a fake SQSEvent to test my function?

public class Handler implements RequestHandler<SQSEvent, Void> {
    @Override
    public Void handleRequest(SQSEvent sqsEvent, Context context) {
        helper(sqsEvent.record);

        return null;
    }
}

Upvotes: 2

Views: 6511

Answers (1)

dossani
dossani

Reputation: 1948

The aws-lambda-java-tests helps to simplify java lambda testing. Please refer here for details.

For sample code, refer Testing AWS Lambda functions written in Java blog.

Upvotes: 3

Related Questions