CompilationGauge extends CachedGauge<Long> { public CompilationGauge(long timeout, TimeUnit timeoutUnit) { super(timeout, timeoutUnit); mxBean = ManagementFactory.getCompilationMXBean(); } CompilationGauge(long timeout, TimeUnit timeoutUnit);  CompilationGauge(long timeout, TimeUnit timeoutUnit, CompilationMXBean mxBean);   }
@Test public void compilationGauge() throws Exception { when(cm.isCompilationTimeMonitoringSupported()).thenReturn(true); when(cm.getTotalCompilationTime()).thenReturn(100L); assertThat(gauge.getValue()).isEqualTo(NOT_AVAILABLE); when(cm.getTotalCompilationTime()).thenReturn(120L); Thread.sleep(1200); assertThat(gauge.getValue()).isEqualTo(20L); }