import static com.amazonaws.services.s3.model.BucketLifecycleConfiguration.*;
public class S3TestUtils {
private AmazonS3 s3Client;
public S3TestUtils(AmazonS3 s3Client) {
this.s3Client = s3Client;
}
public void createBucket(String bucketName) {
s3Client.createBucket(bucketName);
}
public void deleteBucket(String bucketName) {
s3Client.deleteBucket(bucketName);
}
public Set<Bucket> getAllBuckets() {
return s3Client.listBuckets();
}
// Other methods for interacting with S3 service...
}
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
public class DynamoDBTest {
private AmazonDynamoDB dynamoDB;
@Before
public void setup() {
dynamoDB = AmazonDynamoDBClientBuilder.standard()
.withEndpointConfiguration(new EndpointConfiguration("http://localhost:8000", "us-west-2"))
.build();
}
@Test
public void testCreateTable() {
CreateTableResult result = dynamoDB.createTable(new CreateTableRequest()
.withTableName("TestTable")
.withKeySchema(Collections.singletonList(
new KeySchemaElement("id", KeyType.HASH)
))
.withAttributeDefinitions(Collections.singletonList(
new AttributeDefinition("id", ScalarAttributeType.S)
))
.withProvisionedThroughput(new ProvisionedThroughput(5L, 5L))
);
assertNotNull(result.getTableDescription());
assertEquals("TestTable", result.getTableDescription().getTableName());
}
// Other test methods...
}