Class S3MockRule

  • All Implemented Interfaces:
    org.junit.rules.TestRule

    public class S3MockRule
    extends S3MockStarter
    implements org.junit.rules.TestRule
    JUnit rule to start and stop the S3Mock Application. After the tests, the S3Mock is stopped. It should be used as ClassRule:
     @ClassRule
     public static S3MockRule S3_MOCK_RULE = S3MockRule.builder().build();
    
     private final AmazonS3 s3Client = S3_MOCK_RULE.createS3Client();
    
     @Test
     public void doSomethingWithS3() {
       s3Client.createBucket("myBucket");
     }
     
    • Constructor Detail

      • S3MockRule

        public S3MockRule()
        Creates an instance with the default configuration.
    • Method Detail

      • apply

        public org.junit.runners.model.Statement apply​(org.junit.runners.model.Statement base,
                                                       org.junit.runner.Description description)
        Specified by:
        apply in interface org.junit.rules.TestRule