• 0.22.3

Integration Testing With DynamoDB Table/Fixture

This is how your JUnit integration test should look like:

public class FooITCase {
  private Region region;
  private MadeTable table;
  @Before
  public void prepare() {
    this.region = new Region.Simple(your_AWS_credentials);
    this.table = new MadeTable(
      this.region,
      new CreateTableRequest()
        .withTableName("my-sample-table")
        .withProvisionedThroughput(
          new ProvisionedThroughput()
            .withReadCapacityUnits(1L)
            .withWriteCapacityUnits(1L)
        )
        .withAttributeDefinitions(
          new AttributeDefinition()
            .withAttributeName("hash")
            .withAttributeType(ScalarAttributeType.S)
        )
        .withKeySchema(
          new KeySchemaElement()
            .withAttributeName("hash")
            .withKeyType(KeyType.HASH)
        )
    );
    this.table.create();
  }
  @After
  public void dropTable() {
    this.table.drop();
  }
  @Test
  public void createsAndDeletesItems() {
    Foo foo = new Foo(this.region);
    foo.doSomething();
  }
}

MadeTable will create a table on demand and will drop it when tests are finished.