JobRequestHelper { public JobResult testProject(final String jobId, final String spaceName, final String projectName, final String branchName) { final JobResult result = new JobResult(); result.setJobId(jobId); final WorkspaceProject workspaceProject = workspaceProjectService.resolveProject( spacesAPI.getSpace(spaceName), projectName, branchName); if (workspaceProject == null) { return projectDoesNotExistError(jobId, projectName); } final Module module = workspaceProject.getMainModule(); if (module == null) { if (branchName == null) { return projectHasNoMainModuleError(jobId, projectName); } return projectHasNoModuleError(jobId, projectName, branchName); } testService.runAllTests("JobRequestHelper", module.getPomXMLPath(), getCustomTestResultEvent(result)); return result; }  JobResult cloneProject(final String jobId,
                                  final String spaceName,
                                  final CloneProjectRequest cloneProjectRequest); JobResult createProject(final String jobId,
                                   final String spaceName,
                                   final String projectName,
                                   String projectGroupId,
                                   String projectVersion,
                                   String projectDescription); JobResult deleteProject(final String jobId,
                                   final String spaceName,
                                   final String projectName); JobResult compileProject(final String jobId,
                                    final String spaceName,
                                    final String projectName,
                                    final String branchName); JobResult installProject(final String jobId,
                                    final String spaceName,
                                    final String projectName,
                                    final String branchName); JobResult testProject(final String jobId,
                                 final String spaceName,
                                 final String projectName,
                                 final String branchName); JobResult deployProject(final String jobId,
                                   final String spaceName,
                                   final String projectName,
                                   final String branchName); JobResult removeSpace(final String jobId,
                                 final String spaceName); JobResult createSpace(final String jobId,
                                 final String spaceName,
                                 final String spaceDescription,
                                 final String spaceOwner,
                                 final String defaultGroupId); JobResult updateSpace(final String jobId,
                                 final String spaceName,
                                 final String spaceDescription,
                                 final String spaceOwner,
                                 final String defaultGroupId); JobResult addBranch(final String jobId,
                               final String spaceName,
                               final String projectName,
                               final String newBranchName,
                               final String baseBranchName,
                               final String userIdentifier); JobResult removeBranch(final String jobId,
                                  final String spaceName,
                                  final String projectName,
                                  final String branchName,
                                  final String userIdentifier); JobResult addProjectToSpace(final String jobId,
                                       final String spaceName,
                                       final String projectName);  }
@Test public void resourceDoesNotExist() throws Exception { final JobResult jobResult = helper.testProject(null, null, null, null); assertEquals(JobStatus.RESOURCE_NOT_EXIST, jobResult.getStatus()); }
@Test public void projectDoesNotExist() throws Exception { final Path path = mock(Path.class); when(path.getFileName()).thenReturn(""); when(path.toURI()).thenReturn("file: final Branch masterBranch = new Branch("master", path); when(repository.getDefaultBranch()).thenReturn(Optional.of(masterBranch)); when(repository.getBranch("master")).thenReturn(Optional.of(masterBranch)); final JobResult jobResult = helper.testProject(null, space.getName(), "project", null); assertEquals(JobStatus.RESOURCE_NOT_EXIST, jobResult.getStatus()); }