### Question:
Task extends Thread { public boolean isCanceledOrInterrupted() { return canceled || isInterrupted(); } Task(); void setExecutionContext(String taskId, TaskExecutionContext context); @Override void run(); boolean isCanceledOrInterrupted(); void setCanceled(boolean canceled);  }### Answer:
@Test public void isCanceledOrInterrupted() throws InterruptedException { Task tested = getTested(); Assert.assertFalse(tested.isCanceledOrInterrupted()); tested.setCanceled(true); Assert.assertTrue(tested.isCanceledOrInterrupted()); tested.setCanceled(false); Assert.assertFalse(tested.isCanceledOrInterrupted()); }