### Question:
Utils { public static Future<?> runClosureInThread(final Closure done) { if (done == null) { return null; } return runClosureInThread(done, Status.OK()); }  static void verifyGroupId(final String groupId); static void registerClosureExecutorMetrics(final MetricRegistry registry); static Future<?> runClosureInThread(final Closure done); static Future<?> runInThread(final Runnable runnable); @SuppressWarnings("Convert2Lambda") static Future<?> runClosureInThread(final Closure done, final Status status); static int closeQuietly(final Closeable closeable); static int cpus(); static long getProcessId(final long fallback); static ByteBuffer expandByteBuffer(final ByteBuffer buf); static ByteBuffer allocate(final int size); static ByteBuffer allocate(); static ByteBuffer expandByteBufferAtLeast(final ByteBuffer buf, final int minLength); static ByteBuffer expandByteBufferAtMost(final ByteBuffer buf, final int maxLength); static long monotonicMs(); static long nowMs(); static long monotonicUs(); static byte[] getBytes(final String s); static T withLockObject(final T obj); @SuppressWarnings("ConstantConditions") static boolean atomicMoveFile(final File source, final File target, final boolean sync); static void fsync(final File file); static String getString(final byte[] bs, final int off, final int len); static final int MIN_CLOSURE_EXECUTOR_POOL_SIZE; static final int MAX_CLOSURE_EXECUTOR_POOL_SIZE; static final int APPEND_ENTRIES_THREADS_SEND; static final int MAX_APPEND_ENTRIES_TASKS_PER_THREAD; static final boolean USE_MPSC_SINGLE_THREAD_EXECUTOR; static final int RAFT_DATA_BUF_SIZE; static final int MAX_COLLECTOR_SIZE_PER_THREAD; static final String IP_ANY; }### Answer:
@Test public void testRunClosure() throws Exception { CountDownLatch latch = new CountDownLatch(1); Utils.runClosureInThread(new Closure() { @Override public void run(Status status) { assertTrue(status.isOk()); latch.countDown(); } }); latch.await(); }
@Test public void testRunClosureWithStatus() throws Exception { CountDownLatch latch = new CountDownLatch(1); Utils.runClosureInThread(new Closure() { @Override public void run(Status status) { assertFalse(status.isOk()); Assert.assertEquals(RaftError.EACCES.getNumber(), status.getCode()); assertEquals("test 99", status.getErrorMsg()); latch.countDown(); } }, new Status(RaftError.EACCES, "test %d", 99)); latch.await(); }