Package com.adobe.testing.s3mock.junit5
Class S3MockExtension
- java.lang.Object
-
- com.adobe.testing.s3mock.testsupport.common.S3MockStarter
-
- com.adobe.testing.s3mock.junit5.S3MockExtension
-
- All Implemented Interfaces:
org.junit.jupiter.api.extension.AfterAllCallback
,org.junit.jupiter.api.extension.BeforeAllCallback
,org.junit.jupiter.api.extension.Extension
,org.junit.jupiter.api.extension.ParameterResolver
public class S3MockExtension extends S3MockStarter implements org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.AfterAllCallback, org.junit.jupiter.api.extension.ParameterResolver
JUnit extension to start and stop the S3Mock Application. After the tests, the S3Mock is stopped.The following modes are supported:
1. Programmatic registration
public class MyS3Test { @RegisterExtension public static S3MockExtension S3_MOCK = S3MockExtension.builder().build(); private final AmazonS3 s3Client = S3_MOCK.createS3Client(); @Test public void doSomethingWithS3() { s3Client.createBucket("myBucket"); } }
2. Declarative registration
@ExtendWith(S3MockExtension.class) public class MyS3Test { @Test public void doSomethingWithS3(final AmazonS3 s3Client) { s3Client.createBucket("myBucket"); } }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
S3MockExtension.Builder
-
Nested classes/interfaces inherited from class com.adobe.testing.s3mock.testsupport.common.S3MockStarter
S3MockStarter.BaseBuilder<T extends S3MockStarter>
-
-
Field Summary
-
Fields inherited from class com.adobe.testing.s3mock.testsupport.common.S3MockStarter
properties, s3MockFileStore
-
-
Constructor Summary
Constructors Constructor Description S3MockExtension()
Creates an instance with the default configuration.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterAll(org.junit.jupiter.api.extension.ExtensionContext context)
void
beforeAll(org.junit.jupiter.api.extension.ExtensionContext context)
static S3MockExtension.Builder
builder()
java.lang.Object
resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)
boolean
supportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)
-
Methods inherited from class com.adobe.testing.s3mock.testsupport.common.S3MockStarter
configureClientToIgnoreInvalidSslCertificates, createS3Client, createS3Client, createS3ClientV2, defaultProps, getEndpointConfiguration, getHttpPort, getPort, getServiceEndpoint, registerKMSKeyRef, start, stop
-
-
-
-
Method Detail
-
builder
public static S3MockExtension.Builder builder()
-
beforeAll
public void beforeAll(org.junit.jupiter.api.extension.ExtensionContext context)
- Specified by:
beforeAll
in interfaceorg.junit.jupiter.api.extension.BeforeAllCallback
-
afterAll
public void afterAll(org.junit.jupiter.api.extension.ExtensionContext context)
- Specified by:
afterAll
in interfaceorg.junit.jupiter.api.extension.AfterAllCallback
-
supportsParameter
public boolean supportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws org.junit.jupiter.api.extension.ParameterResolutionException
- Specified by:
supportsParameter
in interfaceorg.junit.jupiter.api.extension.ParameterResolver
- Throws:
org.junit.jupiter.api.extension.ParameterResolutionException
-
resolveParameter
public java.lang.Object resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws org.junit.jupiter.api.extension.ParameterResolutionException
- Specified by:
resolveParameter
in interfaceorg.junit.jupiter.api.extension.ParameterResolver
- Throws:
org.junit.jupiter.api.extension.ParameterResolutionException
-
-