Skip to content

Setup S3ClientV2 S3Mock for AWS SDKV2 Junit5 #2260

Open
@Ghjlassi

Description

@Ghjlassi

Hello,

I'm using the resource you provided here to create an S3 client.

   `@RegisterExtension
    static final S3MockExtension S3_MOCK =
            S3MockExtension.builder().silent().withSecureConnection(false).build();

    private S3Client s3Client;

    @Before
    public void setUp() {
        s3Client = S3_MOCK.createS3ClientV2();
        s3Client.createBucket(CreateBucketRequest.builder().bucket("my-bucket").build());
    }`

However, I'm encountering the following error:

java.lang.NullPointerException: Cannot invoke "com.adobe.testing.s3mock.S3MockApplication.getHttpPort()" because "this.s3MockFileStore" is null

It seems that the mock isn’t initializing the endpoint correctly. From what I’ve read, JUnit 5 doesn’t require manually starting S3MockStarter, but I suspect this might be the issue.

Any insights on this?

Thanks!

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions