Instrumentor { private <T> T callChecked( Callable<T> callable, String name, Optional<Double> errorThreshold ) throws Exception { return instrumenting(callable, name, errorThreshold).call(); } Instrumentor();  Instrumentor(
            MetricRegistry metricRegistry,
            HealthCheckRegistry healthCheckRegistry,
            Predicate<Throwable> exceptionFilter); static Builder builder(); HealthCheckRegistry getHealthCheckRegistry(); MetricRegistry getMetricRegistry(); Callable<T> instrumenting(
            Callable<T> callable,
            String name,
            double errorThreshold
    ); CheckedRunnable instrumenting(
            CheckedRunnable runnable,
            String name,
            double errorThreshold
    ); Runnable instrumenting(
            Runnable runnable,
            String name,
            double errorThreshold
    ); void run(
            Runnable runnable,
            String name
    ); void runChecked(
            CheckedRunnable runnable,
            String name
    ); T call(
            Callable<T> callable,
            String name
    ); T callChecked(
            Callable<T> callable,
            String name
    ); void run(
            Runnable runnable,
            String name,
            double errorThreshold
    ); void runChecked(
            CheckedRunnable runnable,
            String name,
            double errorThreshold
    ); T call(
            Callable<T> callable,
            String name,
            double errorThreshold
    ); T callChecked(
            Callable<T> callable,
            String name,
            double errorThreshold
    );  }
@Test public void testCheckedCallable() throws Exception { when(metricRegistry.timer(NAME)).thenReturn(timer); when(metricRegistry.meter(NAME + ".errors")).thenReturn(errorMeter); when(metricRegistry.counter(NAME + ".inFlight")).thenReturn(counter); when(timer.time()).thenReturn(context); Callable<Void> callable = () -> { throw new Exception();}; try { instrumentor.callChecked(callable, NAME, 0.1); } catch (Exception ignored) {} assertTrue(healthCheckRegistry.getNames().contains(NAME)); final InOrder inOrder = inOrder(counter, errorMeter, context); inOrder.verify(counter, times(1)).inc(); inOrder.verify(context, times(1)).close(); inOrder.verify(errorMeter, times(1)).mark(); inOrder.verify(counter, times(1)).dec(); }