### Question:
ExecutionService { public void requestCompletion(long projectId, String jobUrl) { final Execution execution = executionRepository.findByProjectIdAndJobUrl(projectId, jobUrl); if (execution == null || execution.getStatus() != JobStatus.DONE) { executionCompletionRequestRepository.save(new ExecutionCompletionRequest(jobUrl)); } }  @Transactional(readOnly = true) Page<ExecutionWithHandlingCountsDTO> findAll(long projectId, Pageable pageable); @Transactional(readOnly = true) ExecutionWithCountryDeploymentsAndRunsAndExecutedScenariosAndTeamIdsAndErrorsAndProblemsDTO findOneWithRuns(long projectId, long id, ExecutionCriteriaDTO criteria); ExecutionDTO discard(long projectId, long id, String discardReason); ExecutionDTO unDiscard(long projectId, long id); void requestCompletion(long projectId, String jobUrl); String getQualityStatus(long projectId, String jobUrl); List<ExecutionDTO> getLatestEligibleVersions(long projectId); void uploadExecutionReport(long projectId, String projectCode, String branch, String cycle, MultipartFile zipFile); void processSpecificDirectory(CycleDefinition cycleDefinition, File executionDirectory);  }### Answer:
@Test public void requestCompletion_should_register_request_when_execution_not_crawled_yet() { long projectId = 1; when(executionRepository.findByProjectIdAndJobUrl(projectId, "url")).thenReturn(null); ArgumentCaptor<ExecutionCompletionRequest> argument = ArgumentCaptor.forClass(ExecutionCompletionRequest.class); when(executionCompletionRequestRepository.save(argument.capture())).thenReturn(null); cut.requestCompletion(projectId, "url"); assertThat(argument.getValue().getJobUrl()).isEqualTo("url"); }
@Test public void requestCompletion_should_register_request_when_execution_status_is_not_DONE_yet() { long projectId = 1; when(executionRepository.findByProjectIdAndJobUrl(projectId, "url")).thenReturn(new Execution()); ArgumentCaptor<ExecutionCompletionRequest> argument = ArgumentCaptor.forClass(ExecutionCompletionRequest.class); when(executionCompletionRequestRepository.save(argument.capture())).thenReturn(null); cut.requestCompletion(projectId, "url"); assertThat(argument.getValue().getJobUrl()).isEqualTo("url"); }
@Test public void requestCompletion_should_not_register_request_when_execution_status_is_DONE() { long projectId = 1; when(executionRepository.findByProjectIdAndJobUrl(projectId, "url")).thenReturn(new Execution().withStatus(JobStatus.DONE)); cut.requestCompletion(projectId, "url"); verify(executionCompletionRequestRepository, never()).save(any(ExecutionCompletionRequest.class)); }