@Test
  public void insert() throws Exception {
    repository.insert(item()).getUnchecked();
    check(repository.findAll().fetchAll().getUnchecked()).hasSize(1);
    repository.insert(item().withId("another_id")).getUnchecked();
    check(repository.findAll().fetchAll().getUnchecked()).hasSize(2);

    try {
      repository.insert(item()).getUnchecked();
      fail("Didn't fail when duplicate key inserted");
    } catch (Exception ignore) {
    }

    check(repository.findAll().fetchAll().getUnchecked()).hasSize(2);
  }
Basic CRUD operations on the top of repository
mongo/test/org/immutables/mongo/fixture/BasicMongoOperationsTest.java