### Question:
MasterTaskExecThread extends MasterBaseTaskExecThread { public void pauseTask() { taskInstance = processService.findTaskInstanceById(taskInstance.getId()); if(taskInstance == null){ return; } if(StringUtils.isBlank(taskInstance.getHost())){ taskInstance.setState(ExecutionStatus.PAUSE); taskInstance.setEndTime(new Date()); processService.updateTaskInstance(taskInstance); } } MasterTaskExecThread(TaskInstance taskInstance); @Override TaskInstance getTaskInstance(); @Override Boolean submitWaitComplete(); Boolean waitTaskQuit(); void pauseTask(); Boolean existsValidWorkerGroup(String taskInstanceWorkerGroup);  }### Answer:
@Test public void testPauseTask(){ ProcessService processService = Mockito.mock(ProcessService.class); Mockito.when(this.springApplicationContext.getBean(ProcessService.class)) .thenReturn(processService); TaskInstance taskInstance = getTaskInstance(); Mockito.when(processService.findTaskInstanceById(252612)) .thenReturn(taskInstance); Mockito.when(processService.updateTaskInstance(taskInstance)) .thenReturn(true); MasterTaskExecThread masterTaskExecThread = new MasterTaskExecThread(taskInstance); masterTaskExecThread.pauseTask(); org.junit.Assert.assertEquals(ExecutionStatus.PAUSE, taskInstance.getState()); }