### Question:
Task extends Thread { protected void writeTaskLog(String message) { context.writeTaskLog(taskId, message); } Task(); void setExecutionContext(String taskId, TaskExecutionContext context); @Override void run(); boolean isCanceledOrInterrupted(); void setCanceled(boolean canceled);  }### Answer:
@Test public void writeTaskLog() { Task tested = getTested(); tested.taskId = "taskid"; tested.writeTaskLog("mymessage"); Mockito.verify(tested.context).writeTaskLog(tested.taskId, "mymessage"); }