@Test
public void shouldIncrementCounter() throws IOException {

  // init counter
  assertEquals(0, shardedCounter.getCounter(COUNTER_ID1));
  //increment counter by 1
  updateCounterInTransaction(COUNTER_ID1, 1L);
  QueryResults<Entity> results = datastore.run(EntityQuery.newEntityQueryBuilder()
      .setKind(KIND_COUNTER_SHARD)
      .setFilter(CompositeFilter.and(PropertyFilter.eq(PROPERTY_COUNTER_ID, COUNTER_ID1),
          PropertyFilter.eq(PROPERTY_SHARD_VALUE,1)))
      .build());
  // assert there's one and only one shard with the value set to 1
  assertEquals(1L, results.next().getLong(PROPERTY_SHARD_VALUE));
  assertFalse(results.hasNext());
  // assert the correct value is fetched after cache expiry
  shardedCounter.inMemSnapshot.invalidate(COUNTER_ID1);
  assertEquals(1L, shardedCounter.getCounter(COUNTER_ID1));
}