@Test void comittedHeapMemorySizeIsCalculated() { this.mockCollectorWithDefaults(); MemoryUsage heapMemoryUsage = this.memoryBean.getHeapMemoryUsage(); when(heapMemoryUsage.getCommitted()).thenReturn(10L).thenReturn(9L).thenReturn(11L).thenReturn(10L); this.cut.gather(); this.cut.gather(); this.cut.gather(); this.cut.gather(); MemoryInformationData collector = (MemoryInformationData) this.cut.get(); assertThat(collector.getMinComittedHeapMemorySize(), is(9L)); assertThat(collector.getMaxComittedHeapMemorySize(), is(11L)); assertThat(collector.getTotalComittedHeapMemorySize(), is(40L)); }
assertThat(memoryInformationData.getMaxComittedHeapMemorySize(), is(18L));
assertThat(memoryInformationData.getMaxComittedHeapMemorySize(), is(0L));
} else if (comittedHeapMemorySize > this.memoryInformationData.getMaxComittedHeapMemorySize()) { this.memoryInformationData.setMaxComittedHeapMemorySize(comittedHeapMemorySize);
newMemoryInformationData.setMaxComittedHeapMemorySize(this.memoryInformationData.getMaxComittedHeapMemorySize());