@Test void unloadedClassCountIsCalculated() { when(this.runtimeBean.getUnloadedClassCount()).thenReturn(10L).thenReturn(9L).thenReturn(11L).thenReturn(10L); this.cut.gather(); this.cut.gather(); this.cut.gather(); this.cut.gather(); ClassLoadingInformationData collector = (ClassLoadingInformationData) this.cut.get(); assertThat(collector.getMinUnloadedClassCount(), is(9L)); assertThat(collector.getMaxUnloadedClassCount(), is(11L)); assertThat(collector.getTotalUnloadedClassCount(), is(40L)); }
assertThat(classLoadingInformationData.getMaxUnloadedClassCount(), is(12L));
assertThat(classLoadingInformationData.getMaxUnloadedClassCount(), is(0L));
long totalUnloadedClassCount = ((data.getMinUnloadedClassCount() + data.getMaxUnloadedClassCount()) / 2) / count; data.setTotalUnloadedClassCount(totalUnloadedClassCount);
long totalUnloadedClassCount = ((data.getMinUnloadedClassCount() + data.getMaxUnloadedClassCount()) / 2) / count; data.setTotalUnloadedClassCount(totalUnloadedClassCount);
} else if (unloadedClassCount > this.classLoadingInformationData.getMaxUnloadedClassCount()) { this.classLoadingInformationData.setMaxUnloadedClassCount(unloadedClassCount);
/** * {@inheritDoc} */ @Override public SystemSensorData get() { ClassLoadingInformationData newClassLoadingInformationData = new ClassLoadingInformationData(); newClassLoadingInformationData.setPlatformIdent(this.classLoadingInformationData.getPlatformIdent()); newClassLoadingInformationData.setSensorTypeIdent(this.classLoadingInformationData.getSensorTypeIdent()); newClassLoadingInformationData.setCount(this.classLoadingInformationData.getCount()); newClassLoadingInformationData.setTotalLoadedClassCount(this.classLoadingInformationData.getTotalLoadedClassCount()); newClassLoadingInformationData.setMinLoadedClassCount(this.classLoadingInformationData.getMinLoadedClassCount()); newClassLoadingInformationData.setMaxLoadedClassCount(this.classLoadingInformationData.getMaxLoadedClassCount()); newClassLoadingInformationData.setTotalTotalLoadedClassCount(this.classLoadingInformationData.getTotalTotalLoadedClassCount()); newClassLoadingInformationData.setMinTotalLoadedClassCount(this.classLoadingInformationData.getMinTotalLoadedClassCount()); newClassLoadingInformationData.setMaxTotalLoadedClassCount(this.classLoadingInformationData.getMaxTotalLoadedClassCount()); newClassLoadingInformationData.setTotalUnloadedClassCount(this.classLoadingInformationData.getTotalUnloadedClassCount()); newClassLoadingInformationData.setMinUnloadedClassCount(this.classLoadingInformationData.getMinUnloadedClassCount()); newClassLoadingInformationData.setMaxUnloadedClassCount(this.classLoadingInformationData.getMaxUnloadedClassCount()); newClassLoadingInformationData.setTimeStamp(this.classLoadingInformationData.getTimeStamp()); return newClassLoadingInformationData; }