TimeUtil { public static double clock(final Runnable runnable) { return clock(100, runnable); } private  TimeUtil(); static long secondsSince(final long startNanos); static long millisSince(final long startNanos); static long minutesSince(final long startNanos); static long timeSince(final long startNanos, final TimeUnit destUnit); static double clock(final Runnable runnable); static double clock(final int loops, final Runnable runnable); static Pair<Double, S> clockWithResult(final Supplier<S> supplier); static Pair<Double, S> clockWithResult(final int loops, final Supplier<S> supplier);  }
@Test public void shouldRunProcess() { final AtomicInteger ping = new AtomicInteger(0); TimeUtil.clock(ping::incrementAndGet); assertEquals(101, ping.get()); }
@Test public void shouldRunProcess1Time() { final AtomicInteger ping = new AtomicInteger(0); TimeUtil.clock(1, ping::incrementAndGet); assertEquals(2, ping.get()); }