Class BackgroundExecutor


  • public class BackgroundExecutor
    extends java.lang.Object
    Utility class for running code off the main looper thread aka Robolectric test thread.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void runInBackground​(java.lang.Runnable runnable)
      A helper method intended for testing production code that needs to run off the main Looper.
      static <T> T runInBackground​(java.util.concurrent.Callable<T> callable)
      A helper method intended for testing production code that needs to run off the main Looper.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • runInBackground

        public static void runInBackground​(java.lang.Runnable runnable)
        A helper method intended for testing production code that needs to run off the main Looper. Will execute given runnable in a background thread and will do a best-effort attempt at propagating any exception back up to caller in their original form.
      • runInBackground

        public static <T> T runInBackground​(java.util.concurrent.Callable<T> callable)
        A helper method intended for testing production code that needs to run off the main Looper.

        Will execute given callable in a background thread and will do a best-effort attempt at propagating any exception back up to caller in their original form.