An SSCCE of using LocalStack via TestContainers to test a simple AWS Step Function in a Java project with maven build and JUnit 5 Jupyter test framework.
The build is fully integrated with maven and may be run using simply:
mvn clean compile test verify
This will build the main code as well as run unit tests via surefire and integration tests via failsafe.
The code is intended to be modular and reused. While I hope all the code is useful, I suspect the following code may be of particular interest:
src/main/java/io.aleph0.example.testcontainers.sfn.ActivityManager-- ARunnablethat polls for activity tasks. Runs in a standalone thread, either manually or via anExecutor. Responds to thread interrupt.src/main/java/io.aleph0.example.testcontainers.sfn.util.Exceptions-- Captures anExceptionstack trace as aStringfor use in activity task error messages.src/it/java/io.aleph0.example.testcontainers.sfn.ExampleIT-- A self-contained integration test using TestContainers with the JUnit 5 Jupyter to create a CloudFormation stack, run the step function it creates, and then delete the CloudFormation stack.
The code is available under the Apache License v2.