### Question:
Worker implements Runnable { public void act() { synchronized (results) { for (Object o : results) { if (o instanceof Event) { switch ((Event) o) { case START: listener.start(); break; case DONE: listener.done(); break; case CANCEL: listener.cancelled(); break; } } else if (o instanceof Throwable) { listener.error((Throwable) o); } else if (o != null && o.getClass().isArray() && !isCancelled()) { listener.result((Object[]) o); } } results.clear(); } } protected  Worker(); protected  Worker(boolean resultsInUIThread); protected  Worker(boolean resultsInUIThread, boolean cancellable); boolean isResultsInUIThread(); void setController(Controller controller); void setArguments(Object[] args); T getArg(int index); WorkerListener getListener(); void act(); @Override void run(); void cancel(); boolean isCancelled(); boolean isDone();  }### Answer:
@Test public void test() { testWorker(); while (controller.getWorkerExecutor().isWorking()) { try { Thread.sleep(100); app.act(); controller.act(100); } catch (InterruptedException e) { e.printStackTrace(); } } asserts(); }