@Test void comittedNonHeapMemorySizeIsCalculated() { this.mockCollectorWithDefaults(); MemoryUsage nonHeapMemoryUsage = this.memoryBean.getNonHeapMemoryUsage(); when(nonHeapMemoryUsage.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.getMinComittedNonHeapMemorySize(), is(9L)); assertThat(collector.getMaxComittedNonHeapMemorySize(), is(11L)); assertThat(collector.getTotalComittedNonHeapMemorySize(), is(40L)); }
assertThat(memoryInformationData.getMaxComittedNonHeapMemorySize(), is(0L));
assertThat(memoryInformationData.getMaxComittedNonHeapMemorySize(), is(23L)); assertThat(memoryInformationData.getTotalComittedNonHeapMemorySize(), is(24L));
} else if (comittedNonHeapMemorySize > this.memoryInformationData.getMaxComittedNonHeapMemorySize()) { this.memoryInformationData.setMaxComittedNonHeapMemorySize(comittedNonHeapMemorySize);
newMemoryInformationData.setMaxComittedNonHeapMemorySize(this.memoryInformationData.getMaxComittedNonHeapMemorySize()); newMemoryInformationData.setTotalComittedNonHeapMemorySize(this.memoryInformationData.getTotalComittedNonHeapMemorySize());