public void should_query_static_counter_column() throws Exception {
//Given
Long partitionKey = RandomUtils.nextLong(0,Long.MAX_VALUE);
Counter version = CounterBuilder.incr();
ClusteredEntityWithStaticCounter count1 = new ClusteredEntityWithStaticCounter(new ClusteredKeyForCounter(partitionKey, "count1"), version, CounterBuilder.incr(11));
ClusteredEntityWithStaticCounter count2 = new ClusteredEntityWithStaticCounter(new ClusteredKeyForCounter(partitionKey, "count2"), null, CounterBuilder.incr(12));
//When
manager.insert(count1);
manager.insert(count2);
//Then
List<ClusteredEntityWithStaticCounter> found = manager.sliceQuery(ClusteredEntityWithStaticCounter.class)
.forSelect()
.withPartitionComponents(partitionKey)
.get(100);
assertThat(found).hasSize(2);
final ClusteredEntityWithStaticCounter foundCount1 = found.get(0);
final ClusteredEntityWithStaticCounter foundCount2 = found.get(1);
assertThat(foundCount1.getCount().get()).isEqualTo(11L);
assertThat(foundCount2.getCount().get()).isEqualTo(12L);
ClusteredEntityWithStaticCounter count3 = new ClusteredEntityWithStaticCounter(new ClusteredKeyForCounter(partitionKey, "count3"), version, CounterBuilder.incr(13));
manager.insert(count3);
found = manager.sliceQuery(ClusteredEntityWithStaticCounter.class)
.forSelect()
.withPartitionComponents(partitionKey)
.get(100);
assertThat(found).hasSize(3);
final ClusteredEntityWithStaticCounter foundNewCount1 = found.get(0);
final ClusteredEntityWithStaticCounter foundNewCount2 = found.get(1);
final ClusteredEntityWithStaticCounter foundNewCount3 = found.get(2);
assertThat(foundNewCount1.getCount().get()).isEqualTo(11L);
assertThat(foundNewCount1.getVersion().get()).isEqualTo(2L);
assertThat(foundNewCount2.getCount().get()).isEqualTo(12L);
assertThat(foundNewCount2.getVersion().get()).isEqualTo(2L);
assertThat(foundNewCount3.getCount().get()).isEqualTo(13L);
assertThat(foundNewCount3.getVersion().get()).isEqualTo(2L);
}