/** @throws Exception */
 @Test(expected = IllegalStateException.class)
 public void deleteAsyncIllegalTx() throws Exception {
   Key key = ds.put(new Entity("Hoge")).get();
   Transaction tx = ds.beginTransaction().get();
   tx.rollback();
   DatastoreUtil.deleteAsync(ds, tx, Arrays.asList(key)).get();
 }
 /** @throws Exception */
 @Test
 public void deleteAsync() throws Exception {
   Key key = ds.put(new Entity("Hoge")).get();
   Transaction tx = ds.beginTransaction().get();
   DatastoreUtil.deleteAsync(ds, tx, Arrays.asList(key)).get();
   tx.rollback();
   assertThat(tester.count("Hoge"), is(1));
 }
 /** @throws Exception */
 @Test
 public void getAsMapAsyncNoTx() throws Exception {
   Key key = ds.put(new Entity("Hoge")).get();
   Key key2 = ds.put(new Entity("Hoge", key)).get();
   Map<Key, Entity> map = DatastoreUtil.getAsMapAsync(ds, null, Arrays.asList(key, key2)).get();
   assertThat(map, is(notNullValue()));
   assertThat(map.size(), is(2));
 }
 /** @throws Exception */
 @Test(expected = IllegalStateException.class)
 public void getAsMapAsyncTxIsIllegal() throws Exception {
   Key key = ds.put(new Entity("Hoge")).get();
   Key key2 = ds.put(new Entity("Hoge", key)).get();
   Transaction tx = ds.beginTransaction().get();
   tx.rollback();
   DatastoreUtil.getAsMapAsync(ds, tx, Arrays.asList(key, key2));
 }
 /** @throws Exception */
 @Test(expected = IllegalStateException.class)
 public void putAsyncIllegalTx() throws Exception {
   Entity entity = new Entity(KeyFactory.createKey("Hoge", 1));
   Entity entity2 = new Entity(KeyFactory.createKey(entity.getKey(), "Hoge", 1));
   Transaction tx = ds.beginTransaction().get();
   tx.rollback();
   DatastoreUtil.putAsync(ds, tx, Arrays.asList(entity, entity2)).get();
 }
 /** @throws Exception */
 @Test
 public void putAsync() throws Exception {
   Entity entity = new Entity(KeyFactory.createKey("Hoge", 1));
   Entity entity2 = new Entity(KeyFactory.createKey(entity.getKey(), "Hoge", 1));
   Transaction tx = ds.beginTransaction().get();
   List<Key> keys = DatastoreUtil.putAsync(ds, tx, Arrays.asList(entity, entity2)).get();
   tx.rollback();
   assertThat(keys, is(notNullValue()));
   assertThat(keys.size(), is(2));
   assertThat(tester.count("Hoge"), is(0));
 }
 /** @throws Exception */
 @Test
 public void deleteAsyncNoTx() throws Exception {
   Key key = ds.put(new Entity("Hoge")).get();
   DatastoreUtil.deleteAsync(ds, null, Arrays.asList(key)).get();
   assertThat(tester.count("Hoge"), is(0));
 }
 /** @throws Exception */
 @Test(expected = EntityNotFoundRuntimeException.class)
 public void getNoEntityIsFound() throws Exception {
   Transaction tx = ds.beginTransaction().get();
   DatastoreUtil.get(ds, tx, KeyFactory.createKey("Hoge", "xxx"));
 }
 /** @throws Exception */
 @Test
 public void get() throws Exception {
   Key key = ds.put(new Entity("Hoge")).get();
   Transaction tx = ds.beginTransaction().get();
   assertThat(DatastoreUtil.get(ds, tx, key), is(notNullValue()));
 }
 /** @throws Exception */
 @Test
 public void getOrNullNoEntityIsFound() throws Exception {
   Transaction tx = ds.beginTransaction().get();
   assertThat(
       DatastoreUtil.getOrNull(ds, tx, KeyFactory.createKey("Hoge", "xxx")), is(nullValue()));
 }