Class InlineExecutorService

  • All Implemented Interfaces:
    Executor, ExecutorService

    public class InlineExecutorService
    extends Object
    implements ExecutorService
    Executor service that executes posted tasks as soon as they are posted. Intended to be a replacement for RoboExecutorService when using LooperMode.Mode.PAUSED. Unlike RoboExecutorService, will execute tasks on a background thread. This is useful to test Android code that enforces it runs off the main thread. Also consider using MoreExecutors.directExecutor(), if your code under test can handle being called from main thread. Also see PausedExecutorService if you need control over when posted tasks are executed. NOTE: Beta API, subject to change.