• 0.21.4

Unit Testing w/Mock

Since version 0.10 you can use MkRegion class to mock interaction with DynamoDB without even starting DynamoDB Local:

public class FooTest {
  @Test
  public void createsAndDeletesItems() {
    final Region region = new MkRegion(
      new H2Data().with(
        "users",
        new String[] {"id"},
        new String[] {"name", "age"}
      )
    );
    final Table table = region.table("users");
    table.put(
      new Attributes()
        .with("id", 10783)
        .with("name", "Jeff Lebowski")
        .with("age", 35)
    );
    MatcherAssert.assertThat(
      table.frame().iterator().next().get("name"),
      Matchers.equalTo("Jeff Lebowski")
    );
  }
}

H2Data is using H2database for data persistency, that's why you should include these two dependencies to classpath:

<dependency>
  <groupId>com.jcabi</groupId>
  <artifactId>jcabi-jdbc</artifactId>
  <version>0.10</version>
</dependency>
<dependency>
  <groupId>com.h2database</groupId>
  <artifactId>h2</artifactId>
  <version>1.3.175</version>
</dependency>