@Test public void createProject() { String expectedStatus = "Status"; String expectedIssueType = "Issue Type"; String expectedTitle = "Title"; List<String> expectedLabels = Arrays.asList("Label 1", "Label 2"); String expectedJob = "Job"; String expectedSkills = "Skills"; String expectedDescription = "Description"; String expectedLob = "LOB Test"; String expectedCustomer = "Customer"; String expectedLocation = "Anywhere"; String expectedOperationStart = "Maybe tomorrow"; String expectedOperationEnd = "Maybe never"; String expectedEffort = "100h per week"; String expectedFreelancer = "Yup"; String expectedElongation = "Nope"; String expectedOther = "Other stuff"; String expectedDayRate = "Day Rate"; String expectedTravelCostsCompensated = "Compensated"; Project project = new Project("Other ID", expectedStatus, expectedIssueType, expectedTitle, expectedLabels, expectedJob, expectedSkills, expectedDescription, expectedLob, expectedCustomer, expectedLocation, expectedOperationStart, expectedOperationEnd, expectedEffort, null, null, expectedFreelancer, expectedElongation, expectedOther, expectedDayRate, expectedTravelCostsCompensated); given(projectRepo.save(project)).willReturn(project); Project createdProject = projectService.createProject(project); SoftAssertions softly = new SoftAssertions(); softly.assertThat(createdProject.getStatus()).isEqualTo(expectedStatus); softly.assertThat(createdProject.getIssuetype()).isEqualTo(expectedIssueType); softly.assertThat(createdProject.getTitle()).isEqualTo(expectedTitle); softly.assertThat(createdProject.getLabels()).isEqualTo(expectedLabels); softly.assertThat(createdProject.getJob()).isEqualTo(expectedJob); softly.assertThat(createdProject.getSkills()).isEqualTo(expectedSkills); softly.assertThat(createdProject.getDescription()).isEqualTo(expectedDescription); softly.assertThat(createdProject.getLob()).isEqualTo(expectedLob); softly.assertThat(createdProject.getCustomer()).isEqualTo(expectedCustomer); softly.assertThat(createdProject.getLocation()).isEqualTo(expectedLocation); softly.assertThat(createdProject.getOperationStart()).isEqualTo(expectedOperationStart); softly.assertThat(createdProject.getOperationEnd()).isEqualTo(expectedOperationEnd); softly.assertThat(createdProject.getEffort()).isEqualTo(expectedEffort); softly.assertThat(createdProject.getFreelancer()).isEqualTo(expectedFreelancer); softly.assertThat(createdProject.getElongation()).isEqualTo(expectedElongation); softly.assertThat(createdProject.getOther()).isEqualTo(expectedOther); softly.assertThat(createdProject.getCreated()).isEqualTo(LocalDateTime.now(clock)); softly.assertThat(createdProject.getUpdated()).isEqualTo(LocalDateTime.now(clock)); softly.assertAll(); }
@Override public Project createProject(Project project) { return createOrUpdateProject(project, null); }
RepositoryProjectService implements ProjectService { @Override public Project createProject(Project project) { return createOrUpdateProject(project, null); } }
RepositoryProjectService implements ProjectService { @Override public Project createProject(Project project) { return createOrUpdateProject(project, null); } @Autowired  RepositoryProjectService(ProjectRepository projectRepo,
                                    ProjectApplicationRepository applicationRepo,
                                    UserRepository userRepo,
                                    UserService userService,
                                    Clock clock); }
RepositoryProjectService implements ProjectService { @Override public Project createProject(Project project) { return createOrUpdateProject(project, null); } @Autowired  RepositoryProjectService(ProjectRepository projectRepo,
                                    ProjectApplicationRepository applicationRepo,
                                    UserRepository userRepo,
                                    UserService userService,
                                    Clock clock); @Override @Transactional(readOnly = true) Project getProjectById(String projectId); @Override @Transactional(readOnly = true) boolean projectExists(String projectId); @Override Project save(Project project); @Override List<Project> saveAll(List<Project> projects); @Override Project createProject(Project project); }
RepositoryProjectService implements ProjectService { @Override public Project createProject(Project project) { return createOrUpdateProject(project, null); } @Autowired  RepositoryProjectService(ProjectRepository projectRepo,
                                    ProjectApplicationRepository applicationRepo,
                                    UserRepository userRepo,
                                    UserService userService,
                                    Clock clock); @Override @Transactional(readOnly = true) Project getProjectById(String projectId); @Override @Transactional(readOnly = true) boolean projectExists(String projectId); @Override Project save(Project project); @Override List<Project> saveAll(List<Project> projects); @Override Project createProject(Project project);  }