### Question:
EnvironmentServiceImpl implements EnvironmentService { @Override public void stopProjectEnvironment(String project) { log.debug("Stopping environment for project {}", project); checkProjectResourceConditions(project, "stop"); exploratoryDAO.fetchRunningExploratoryFieldsForProject(project) .forEach(this::stopNotebookWithServiceAccount); projectService.get(project).getEndpoints().stream() .filter(e -> UserInstanceStatus.RUNNING == e.getStatus()) .forEach(endpoint -> projectService.stop(securityService.getServiceAccountInfo("admin"), endpoint.getName(), project)); } @Inject  EnvironmentServiceImpl(EnvDAO envDAO, UserSettingsDAO settingsDAO, ExploratoryDAO exploratoryDAO,
								  ExploratoryService exploratoryService, ComputationalService computationalService,
								  SecurityService securityService, ProjectService projectService); @Override List<UserDTO> getUsers(); @Override List<UserResourceInfo> getAllEnv(UserInfo user); @Override void stopAll(); @Override void stopEnvironmentWithServiceAccount(String user); @Override void stopProjectEnvironment(String project); @ProjectAdmin @Override void stopExploratory(@User UserInfo userInfo, String user, @Project String project, String exploratoryName); @ProjectAdmin @Override void stopComputational(@User UserInfo userInfo, String user, @Project String project, String exploratoryName,
								  String computationalName); @ProjectAdmin @Override void terminateExploratory(@User UserInfo userInfo, String user, @Project String project, String exploratoryName); @ProjectAdmin @Override void terminateComputational(@User UserInfo userInfo, String user, @Project String project,
									   String exploratoryName, String computationalName);  }### Answer:
@Test public void stopProjectEnvironment() { final UserInfo userInfo = getUserInfo(); final ProjectDTO projectDTO = getProjectDTO(); when(exploratoryDAO.fetchRunningExploratoryFieldsForProject(anyString())).thenReturn(getUserInstances()); when(securityService.getServiceAccountInfo(anyString())).thenReturn(userInfo); when(exploratoryService.stop(any(UserInfo.class), anyString(), anyString())).thenReturn(UUID); when(projectService.get(anyString())).thenReturn(projectDTO); doNothing().when(projectService).stop(any(UserInfo.class), anyString(), anyString()); environmentService.stopProjectEnvironment(PROJECT_NAME); verify(exploratoryDAO).fetchRunningExploratoryFieldsForProject(PROJECT_NAME); verify(exploratoryService).stop(refEq(userInfo), eq(PROJECT_NAME), eq(EXPLORATORY_NAME_1)); verify(exploratoryService).stop(refEq(userInfo), eq(PROJECT_NAME), eq(EXPLORATORY_NAME_2)); verify(securityService, times(2)).getServiceAccountInfo(USER); verify(securityService).getServiceAccountInfo(ADMIN); verify(projectService).get(eq(PROJECT_NAME)); verify(projectService).stop(refEq(userInfo), eq(ENDPOINT_NAME), eq(PROJECT_NAME)); verify(exploratoryDAO).fetchProjectExploratoriesWhereStatusIn(PROJECT_NAME, Arrays.asList(UserInstanceStatus.CREATING, UserInstanceStatus.STARTING, UserInstanceStatus.CREATING_IMAGE), UserInstanceStatus.CREATING, UserInstanceStatus.STARTING, UserInstanceStatus.CREATING_IMAGE); verifyNoMoreInteractions(exploratoryDAO, exploratoryService, securityService, projectService); }