### Question:
UiUtils { public static void runOnPreDrawOnce(final View view, final Runnable task) { view.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { view.getViewTreeObserver().removeOnPreDrawListener(this); task.run(); return true; } }); }  static void runOnPreDrawOnce(final View view, final Runnable task); static void runOnMeasured(View view, Runnable task); static void runOnMainThread(Runnable runnable); static float getWindowHeight(Context context); static float getWindowWidth(Context context); static int getStatusBarHeight(Context context); static int getTopBarHeightDp(Context context); static int getTopBarHeight(Context context); static float dpToPx(Context context, float dp); static int dpToPx(Context context, int dp); static float pxToDp(Context context, float px); static float dpToSp(Context context, float dp);  }### Answer:
@Test public void runOnPreDrawOnce() { View view = new View(newActivity()); Runnable task = mock(Runnable.class); verifyZeroInteractions(task); UiUtils.runOnPreDrawOnce(view, task); dispatchPreDraw(view); verify(task, times(1)).run(); }