@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.getMinComittedHeapMemorySize(), is(17L)); assertThat(memoryInformationData.getMaxComittedHeapMemorySize(), is(18L));
assertThat(memoryInformationData.getMinComittedHeapMemorySize(), is(Long.MAX_VALUE)); assertThat(memoryInformationData.getMaxComittedHeapMemorySize(), is(0L));
if (comittedHeapMemorySize < this.memoryInformationData.getMinComittedHeapMemorySize()) { this.memoryInformationData.setMinComittedHeapMemorySize(comittedHeapMemorySize); } else if (comittedHeapMemorySize > this.memoryInformationData.getMaxComittedHeapMemorySize()) {
newMemoryInformationData.setMinComittedHeapMemorySize(this.memoryInformationData.getMinComittedHeapMemorySize()); newMemoryInformationData.setMaxComittedHeapMemorySize(this.memoryInformationData.getMaxComittedHeapMemorySize());