HandlerThreadWrapper { public boolean isAlive(){ if(mHandlerThread == null){ return false; } return mHandlerThread.isAlive(); } HandlerThreadWrapper(@NonNull String threadName);  HandlerThreadWrapper(@NonNull String threadName, @Nullable Handler.Callback callback); @NonNull Handler getHandler(); boolean isAlive(); void quit();  }
@Test public void isAlive() throws Exception { HandlerThreadWrapper mHandlerThreadWrapper = new HandlerThreadWrapper("test"); boolean result = mHandlerThreadWrapper.isAlive(); assertTrue(result); mHandlerThreadWrapper.quit(); Thread.sleep(200); result = mHandlerThreadWrapper.isAlive(); assertFalse(result); }