### Question:
ClosureUtils { public static <E> Closure<E> whileClosure(final Predicate<? super E> predicate, final Closure<? super E> closure) { return WhileClosure.<E>whileClosure(predicate, closure, false); } private  ClosureUtils(); static Closure<E> exceptionClosure(); static Closure<E> nopClosure(); static Closure<E> asClosure(final Transformer<? super E, ?> transformer); static Closure<E> forClosure(final int count, final Closure<? super E> closure); static Closure<E> whileClosure(final Predicate<? super E> predicate, final Closure<? super E> closure); static Closure<E> doWhileClosure(final Closure<? super E> closure,
                                                final Predicate<? super E> predicate); static Closure<E> invokerClosure(final String methodName); static Closure<E> invokerClosure(final String methodName, final Class<?>[] paramTypes,
                                                final Object[] args); static Closure<E> chainedClosure(final Closure<? super E>... closures); static Closure<E> chainedClosure(final Collection<? extends Closure<? super E>> closures); static Closure<E> ifClosure(final Predicate<? super E> predicate,
                                           final Closure<? super E> trueClosure); static Closure<E> ifClosure(final Predicate<? super E> predicate,
                                           final Closure<? super E> trueClosure,
                                           final Closure<? super E> falseClosure); static Closure<E> switchClosure(final Predicate<? super E>[] predicates,
                                               final Closure<? super E>[] closures); static Closure<E> switchClosure(final Predicate<? super E>[] predicates,
                                               final Closure<? super E>[] closures,
                                               final Closure<? super E> defaultClosure); static Closure<E> switchClosure(final Map<Predicate<E>, Closure<E>> predicatesAndClosures); @SuppressWarnings("unchecked") static Closure<E> switchMapClosure(final Map<? extends E, Closure<E>> objectsAndClosures);  }### Answer:
@Test public void testWhileClosure() { MockClosure<Object> cmd = new MockClosure<Object>(); ClosureUtils.whileClosure(FalsePredicate.falsePredicate(), cmd).execute(null); assertEquals(0, cmd.count); cmd = new MockClosure<Object>(); ClosureUtils.whileClosure(PredicateUtils.uniquePredicate(), cmd).execute(null); assertEquals(1, cmd.count); try { ClosureUtils.whileClosure(null, ClosureUtils.nopClosure()); fail(); } catch (final NullPointerException ex) {} try { ClosureUtils.whileClosure(FalsePredicate.falsePredicate(), null); fail(); } catch (final NullPointerException ex) {} try { ClosureUtils.whileClosure(null, null); fail(); } catch (final NullPointerException ex) {} }