ProjectServiceImpl implements ProjectService { @Transactional @Auditable(actionType = AuditActionType.CREATE) @Override public Project createProject(Project project) { return updateProject(project); } @Autowired  ProjectServiceImpl(ProjectDao projectDAO, ProjectAssignmentManagementService projectAssignmentManagementService, AggregateReportService aggregateReportService, UserService userService); @Override List<Project> getProjects(); @Override List<Project> getActiveProjects(); Project getProject(Integer projectId); Project getProjectAndCheckDeletability(Integer projectId); void setProjectDeletability(Project project); @Transactional @Auditable(actionType = AuditActionType.CREATE) @Override Project createProject(Project project); @Transactional @Override Project updateProject(Project project); @Override @Transactional void validatePMRoles(Project project); @Transactional @Auditable(actionType = AuditActionType.DELETE) void deleteProject(Integer projectId); List<Project> getProjectManagerProjects(User user);  }
@Test public void should_create_or_update_project() { Project project = ProjectObjectMother.createProject(1); User pm = UserObjectMother.createUser(); project.setProjectManager(pm); projectService.createProject(project); verify(projectDao).persist(project); verify(userService).validateProjectManagementRoles(pm.getPK()); }
@Test public void should_create_project_and_assign_to_default_project() { Project project = ProjectObjectMother.createProject(1); User pm = UserObjectMother.createUser(); project.setProjectManager(pm); project.setDefaultProject(true); projectService.createProject(project); verify(projectDao).persist(project); verify(projectAssignmentManagementService).assignAllUsersToProject(project); }