### Question:
ExploratoryServiceImpl implements ExploratoryService { @Override public String terminate(UserInfo userInfo, String project, String exploratoryName) { return action(userInfo, project, exploratoryName, EXPLORATORY_TERMINATE, TERMINATING); }  @BudgetLimited @Override String start(UserInfo userInfo, String exploratoryName, @Project String project); @Override String stop(UserInfo userInfo, String project, String exploratoryName); @Override String terminate(UserInfo userInfo, String project, String exploratoryName); @BudgetLimited @Override String create(UserInfo userInfo, Exploratory exploratory, @Project String project); @Override void updateProjectExploratoryStatuses(String project, String endpoint, UserInstanceStatus status); @Override void updateClusterConfig(UserInfo userInfo, String project, String exploratoryName, List<ClusterConfig> config); @Override Optional<UserInstanceDTO> getUserInstance(String user, String project, String exploratoryName); @Override Optional<UserInstanceDTO> getUserInstance(String user, String project, String exploratoryName, boolean includeCompResources); @Override List<UserInstanceDTO> findAll(); @Override List<UserInstanceDTO> findAll(Set<ProjectDTO> projects); @Override List<ClusterConfig> getClusterConfig(UserInfo user, String project, String exploratoryName); @Override ExploratoryCreatePopUp getUserInstances(UserInfo user);  }### Answer:
@Test public void terminate() { when(endpointService.get(anyString())).thenReturn(endpointDTO()); when(exploratoryDAO.updateExploratoryStatus(any(StatusEnvBaseDTO.class))).thenReturn(mock(UpdateResult.class)); when(computationalDAO.updateComputationalStatusesForExploratory(any(StatusEnvBaseDTO.class))).thenReturn(1); when(exploratoryDAO.fetchExploratoryFields(anyString(), anyString(), anyString())).thenReturn(userInstance); ExploratoryActionDTO eaDto = new ExploratoryActionDTO(); eaDto.withExploratoryName(EXPLORATORY_NAME); when(requestBuilder.newExploratoryStop(any(UserInfo.class), any(UserInstanceDTO.class), any(EndpointDTO.class))) .thenReturn(eaDto); String exploratoryTerminate = "exploratory/terminate"; when(provisioningService.post(anyString(), anyString(), any(ExploratoryActionDTO.class), any())).thenReturn (UUID); when(requestId.put(anyString(), anyString())).thenReturn(UUID); String uuid = exploratoryService.terminate(userInfo, PROJECT, EXPLORATORY_NAME); assertNotNull(uuid); assertEquals(UUID, uuid); statusEnvBaseDTO = getStatusEnvBaseDTOWithStatus("terminating"); verify(exploratoryDAO).updateExploratoryStatus(refEq(statusEnvBaseDTO, "self")); verify(exploratoryDAO).fetchExploratoryFields(USER, PROJECT, EXPLORATORY_NAME); verify(computationalDAO).updateComputationalStatusesForExploratory(USER, PROJECT, EXPLORATORY_NAME, UserInstanceStatus.TERMINATING, UserInstanceStatus.TERMINATING, UserInstanceStatus.TERMINATED, UserInstanceStatus.FAILED); verify(requestBuilder).newExploratoryStop(userInfo, userInstance, endpointDTO()); verify(provisioningService).post(endpointDTO().getUrl() + exploratoryTerminate, TOKEN, eaDto, String.class); verify(requestId).put(USER, UUID); verifyNoMoreInteractions(exploratoryDAO, computationalDAO, requestBuilder, provisioningService, requestId); }