@Test
public void incrementsModificationCountOnEachCreationAndDestruction() {
Statistics osStatistics = mock(Statistics.class, "os");
Statistics atomicStatistics = mock(Statistics.class, "atomic");
when(osStatisticsFactory.create(any(), any(), anyLong(), anyLong(), anyInt(), any()))
.thenReturn(osStatistics);
when(atomicStatisticsFactory.create(any(), any(), anyLong(), anyLong(), any()))
.thenReturn(atomicStatistics);
registry.createAtomicStatistics(type, STATISTICS_TEXT_ID, STATISTICS_NUMERIC_ID);
assertThat(registry.getStatListModCount())
.as("modification count after first modification")
.isEqualTo(1);
registry.createOsStatistics(type, STATISTICS_TEXT_ID, STATISTICS_NUMERIC_ID,
STATISTICS_OS_FLAGS);
assertThat(registry.getStatListModCount())
.as("modification count after second modification")
.isEqualTo(2);
registry.destroyStatistics(osStatistics);
assertThat(registry.getStatListModCount())
.as("modification count after third modification")
.isEqualTo(3);
registry.destroyStatistics(atomicStatistics);
assertThat(registry.getStatListModCount())
.as("modification count after fourth modification")
.isEqualTo(4);
}