diff --git a/corn-backend/src/main/java/dev/corn/cornbackend/api/sprint/SprintControllerImpl.java b/corn-backend/src/main/java/dev/corn/cornbackend/api/sprint/SprintControllerImpl.java index 541cd7c0..6bf9fc67 100644 --- a/corn-backend/src/main/java/dev/corn/cornbackend/api/sprint/SprintControllerImpl.java +++ b/corn-backend/src/main/java/dev/corn/cornbackend/api/sprint/SprintControllerImpl.java @@ -38,9 +38,9 @@ public class SprintControllerImpl implements SprintController { @Override @PostMapping(value = ADD_SPRINT) - public SprintResponse addNewSprint(@RequestBody SprintRequest sprintRequest) { + public SprintResponse addNewSprint(@RequestBody SprintRequest sprintRequest, @JwtAuthed User user) { return sprintService.addNewSprint(sprintRequest.name(), sprintRequest.startDate(), - sprintRequest.endDate(), sprintRequest.description()); + sprintRequest.endDate(), sprintRequest.description(), user); } @Override @@ -51,38 +51,38 @@ public SprintResponse getSprintById(@RequestParam long sprintId, @JwtAuthed User @Override @GetMapping(value = GET_SPRINTS_ON_PAGE) - public List getSprintsOnPage(@RequestParam int page, @JwtAuthed User user) { - return sprintService.getSprintsOnPage(page, user); + public List getSprintsOnPage(@RequestParam int page, @RequestParam long projectId, @JwtAuthed User user) { + return sprintService.getSprintsOnPage(page, projectId, user); } @Override @PatchMapping(value = UPDATE_SPRINTS_NAME) - public SprintResponse updateSprintsName(@RequestParam String name, @RequestParam long sprintId) { - return sprintService.updateSprintsName(name, sprintId); + public SprintResponse updateSprintsName(@RequestParam String name, @RequestParam long sprintId, @JwtAuthed User user) { + return sprintService.updateSprintsName(name, sprintId, user); } @Override @PatchMapping(value = UPDATE_SPRINTS_DESCRIPTION) - public SprintResponse updateSprintsDescription(@RequestParam String description, @RequestParam long sprintId) { - return sprintService.updateSprintsDescription(description, sprintId); + public SprintResponse updateSprintsDescription(@RequestParam String description, @RequestParam long sprintId, @JwtAuthed User user) { + return sprintService.updateSprintsDescription(description, sprintId, user); } @Override @PatchMapping(value = UPDATE_SPRINTS_START_DATE) - public SprintResponse updateSprintsStartDate(@RequestParam LocalDate startDate, @RequestParam long sprintId) { - return sprintService.updateSprintsStartDate(startDate, sprintId); + public SprintResponse updateSprintsStartDate(@RequestParam LocalDate startDate, @RequestParam long sprintId, @JwtAuthed User user) { + return sprintService.updateSprintsStartDate(startDate, sprintId, user); } @Override @PatchMapping(value = UPDATE_SPRINTS_END_DATE) - public SprintResponse updateSprintsEndDate(@RequestParam LocalDate endDate, @RequestParam long sprintId) { - return sprintService.updateSprintsEndDate(endDate, sprintId); + public SprintResponse updateSprintsEndDate(@RequestParam LocalDate endDate, @RequestParam long sprintId, @JwtAuthed User user) { + return sprintService.updateSprintsEndDate(endDate, sprintId, user); } @Override @DeleteMapping(value = DELETE_SPRINT) - public SprintResponse deleteSprint(@RequestParam long sprintId) { - return sprintService.deleteSprint(sprintId); + public SprintResponse deleteSprint(@RequestParam long sprintId, @JwtAuthed User user) { + return sprintService.deleteSprint(sprintId, user); } } diff --git a/corn-backend/src/main/java/dev/corn/cornbackend/api/sprint/SprintServiceImpl.java b/corn-backend/src/main/java/dev/corn/cornbackend/api/sprint/SprintServiceImpl.java index c727eb8b..38150bb7 100644 --- a/corn-backend/src/main/java/dev/corn/cornbackend/api/sprint/SprintServiceImpl.java +++ b/corn-backend/src/main/java/dev/corn/cornbackend/api/sprint/SprintServiceImpl.java @@ -27,7 +27,10 @@ public class SprintServiceImpl implements SprintService { private final SprintMapper sprintMapper; @Override - public final SprintResponse addNewSprint(String name, LocalDate startDate, LocalDate endDate, String description) { + public final SprintResponse addNewSprint(String name, LocalDate startDate, LocalDate endDate, String description, User user) { + + //auth user + Sprint sprint = Sprint .builder() .sprintName(name) @@ -50,6 +53,8 @@ public final SprintResponse addNewSprint(String name, LocalDate startDate, Local public final SprintResponse getSprintById(long sprintId, User user) { log.info("Getting sprint with id: {} for user: {}", sprintId, user); + //auth user + Sprint sprint = sprintRepository.findById(sprintId) .orElseThrow(() -> new SprintDoesNotExistException(sprintId)); log.info("Sprint found : {}", sprint); @@ -58,20 +63,24 @@ public final SprintResponse getSprintById(long sprintId, User user) { } @Override - public final List getSprintsOnPage(int page, User user) { - log.info("Getting sprints on page: {} for user: {}", page, user); + public final List getSprintsOnPage(int page, long projectId, User user) { + log.info("Getting sprints in project {} on page: {} for user: {}", projectId, page, user); + + //auth user Pageable pageable = PageRequest.of(page, SPRINTS_PER_PAGE); - Page sprints = sprintRepository.findAllByOwnerOrderByName(user, pageable); + Page sprints = sprintRepository.findAllByProjectId(projectId, pageable); log.info("Sprints found on page : {}", sprints.getTotalElements()); return sprints.map(sprintMapper::toSprintResponse).toList(); } @Override - public final SprintResponse updateSprintsName(String name, long sprintId) { + public final SprintResponse updateSprintsName(String name, long sprintId, User user) { log.info("Updating sprint with id: {} name to: {}", sprintId, name); + //auth user + Sprint sprintToUpdate = sprintRepository.findById(sprintId) .orElseThrow(() -> new SprintDoesNotExistException(sprintId)); log.info("Found sprint to update: {}", sprintToUpdate); @@ -84,9 +93,11 @@ public final SprintResponse updateSprintsName(String name, long sprintId) { } @Override - public final SprintResponse updateSprintsDescription(String description, long sprintId) { + public final SprintResponse updateSprintsDescription(String description, long sprintId, User user) { log.info("Updating sprint with id: {} description to: {}", sprintId, description); + //auth user + Sprint sprintToUpdate = sprintRepository.findById(sprintId) .orElseThrow(() -> new SprintDoesNotExistException(sprintId)); log.info("Found sprint to update: {}", sprintToUpdate); @@ -99,9 +110,11 @@ public final SprintResponse updateSprintsDescription(String description, long sp } @Override - public final SprintResponse updateSprintsStartDate(LocalDate startDate, long sprintId) { + public final SprintResponse updateSprintsStartDate(LocalDate startDate, long sprintId, User user) { log.info("Updating sprint with id: {} startDate to: {}", sprintId, startDate); + //auth user + Sprint sprintToUpdate = sprintRepository.findById(sprintId) .orElseThrow(() -> new SprintDoesNotExistException(sprintId)); log.info("Found sprint to update: {}", sprintToUpdate); @@ -118,9 +131,11 @@ public final SprintResponse updateSprintsStartDate(LocalDate startDate, long spr } @Override - public final SprintResponse updateSprintsEndDate(LocalDate endDate, long sprintId) { + public final SprintResponse updateSprintsEndDate(LocalDate endDate, long sprintId, User user) { log.info("Updating sprint with id: {} endDate to: {}", sprintId, endDate); + //auth user + Sprint sprintToUpdate = sprintRepository.findById(sprintId) .orElseThrow(() -> new SprintDoesNotExistException(sprintId)); log.info("Found sprint to update: {}", sprintToUpdate); @@ -137,9 +152,11 @@ public final SprintResponse updateSprintsEndDate(LocalDate endDate, long sprintI } @Override - public final SprintResponse deleteSprint(long sprintId) { + public final SprintResponse deleteSprint(long sprintId, User user) { log.info("Deleting sprint with id: {}", sprintId); + //auth user + Sprint sprintToDelete = sprintRepository.findById(sprintId) .orElseThrow(() -> new SprintDoesNotExistException(sprintId)); log.info("Found sprint to delete: {}", sprintToDelete); diff --git a/corn-backend/src/main/java/dev/corn/cornbackend/api/sprint/interfaces/SprintController.java b/corn-backend/src/main/java/dev/corn/cornbackend/api/sprint/interfaces/SprintController.java index 9d97c261..77920585 100644 --- a/corn-backend/src/main/java/dev/corn/cornbackend/api/sprint/interfaces/SprintController.java +++ b/corn-backend/src/main/java/dev/corn/cornbackend/api/sprint/interfaces/SprintController.java @@ -2,6 +2,7 @@ import dev.corn.cornbackend.api.sprint.data.SprintRequest; import dev.corn.cornbackend.api.sprint.data.SprintResponse; +import dev.corn.cornbackend.entities.project.Project; import dev.corn.cornbackend.entities.user.User; import java.time.LocalDate; @@ -9,20 +10,20 @@ public interface SprintController { - SprintResponse addNewSprint(SprintRequest sprintRequest); + SprintResponse addNewSprint(SprintRequest sprintRequest, User user); SprintResponse getSprintById(long sprintId, User user); - List getSprintsOnPage(int page, User user); + List getSprintsOnPage(int page, long projectId, User user); - SprintResponse updateSprintsName(String name, long sprintId); + SprintResponse updateSprintsName(String name, long sprintId, User user); - SprintResponse updateSprintsDescription(String description, long sprintId); + SprintResponse updateSprintsDescription(String description, long sprintId, User user); - SprintResponse updateSprintsStartDate(LocalDate startDate, long sprintId); + SprintResponse updateSprintsStartDate(LocalDate startDate, long sprintId, User user); - SprintResponse updateSprintsEndDate(LocalDate endDate, long sprintId); + SprintResponse updateSprintsEndDate(LocalDate endDate, long sprintId, User user); - SprintResponse deleteSprint(long sprintId); + SprintResponse deleteSprint(long sprintId, User user); } diff --git a/corn-backend/src/main/java/dev/corn/cornbackend/api/sprint/interfaces/SprintService.java b/corn-backend/src/main/java/dev/corn/cornbackend/api/sprint/interfaces/SprintService.java index bf7f44ae..3217495a 100644 --- a/corn-backend/src/main/java/dev/corn/cornbackend/api/sprint/interfaces/SprintService.java +++ b/corn-backend/src/main/java/dev/corn/cornbackend/api/sprint/interfaces/SprintService.java @@ -1,6 +1,7 @@ package dev.corn.cornbackend.api.sprint.interfaces; import dev.corn.cornbackend.api.sprint.data.SprintResponse; +import dev.corn.cornbackend.entities.project.Project; import dev.corn.cornbackend.entities.user.User; import java.time.LocalDate; @@ -8,20 +9,20 @@ public interface SprintService { - SprintResponse addNewSprint(String name, LocalDate startDate, LocalDate endDate, String description); + SprintResponse addNewSprint(String name, LocalDate startDate, LocalDate endDate, String description, User user); SprintResponse getSprintById(long sprintId, User user); - List getSprintsOnPage(int page, User user); + List getSprintsOnPage(int page, long projectId, User user); - SprintResponse updateSprintsName(String name, long sprintId); + SprintResponse updateSprintsName(String name, long sprintId, User user); - SprintResponse updateSprintsDescription(String description, long sprintId); + SprintResponse updateSprintsDescription(String description, long sprintId, User user); - SprintResponse updateSprintsStartDate(LocalDate startDate, long sprintId); + SprintResponse updateSprintsStartDate(LocalDate startDate, long sprintId, User user); - SprintResponse updateSprintsEndDate(LocalDate endDate, long sprintId); + SprintResponse updateSprintsEndDate(LocalDate endDate, long sprintId, User user); - SprintResponse deleteSprint(long sprintId); + SprintResponse deleteSprint(long sprintId, User user); } diff --git a/corn-backend/src/main/java/dev/corn/cornbackend/entities/sprint/interfaces/SprintRepository.java b/corn-backend/src/main/java/dev/corn/cornbackend/entities/sprint/interfaces/SprintRepository.java index 8ec2c98d..7b1da662 100644 --- a/corn-backend/src/main/java/dev/corn/cornbackend/entities/sprint/interfaces/SprintRepository.java +++ b/corn-backend/src/main/java/dev/corn/cornbackend/entities/sprint/interfaces/SprintRepository.java @@ -1,13 +1,17 @@ package dev.corn.cornbackend.entities.sprint.interfaces; import dev.corn.cornbackend.entities.sprint.Sprint; -import dev.corn.cornbackend.entities.user.User; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Repository; +@Repository public interface SprintRepository extends JpaRepository { - Page findAllByOwnerOrderByName(User owner, Pageable pageable); -} + @Query("SELECT s FROM Sprint s WHERE s.project.projectId = ?1") + Page findAllByProjectId(long projectId, Pageable pageable); + +} \ No newline at end of file diff --git a/corn-backend/src/test/java/dev/corn/cornbackend/api/sprint/SprintControllerTest.java b/corn-backend/src/test/java/dev/corn/cornbackend/api/sprint/SprintControllerTest.java index edca4726..ca6f3454 100644 --- a/corn-backend/src/test/java/dev/corn/cornbackend/api/sprint/SprintControllerTest.java +++ b/corn-backend/src/test/java/dev/corn/cornbackend/api/sprint/SprintControllerTest.java @@ -39,10 +39,10 @@ final void test_addNewSprint_shouldAddNewSprint() { // when when(sprintService.addNewSprint(ADD_SPRINT_DATA.name(), ADD_SPRINT_DATA.startDate(), - ADD_SPRINT_DATA.endDate(), ADD_SPRINT_DATA.description())) + ADD_SPRINT_DATA.endDate(), ADD_SPRINT_DATA.description(), ADD_SPRINT_DATA.project().getOwner())) .thenReturn(expected); - SprintResponse actual = sprintController.addNewSprint(ADD_SPRINT_DATA.asSprintRequest()); + SprintResponse actual = sprintController.addNewSprint(ADD_SPRINT_DATA.asSprintRequest(), ADD_SPRINT_DATA.project().getOwner()); // then assertEquals(expected, actual, SPRINT_RESPONSE_SHOULD_BE_EQUAL_TO_EXPECTED); @@ -70,10 +70,12 @@ final void test_getSprintsOnPage_shouldGetSprints() { int page = 0; // when - when(sprintService.getSprintsOnPage(page, ADD_SPRINT_DATA.project().getOwner())) + when(sprintService.getSprintsOnPage(page, ADD_SPRINT_DATA.project().getProjectId(), + ADD_SPRINT_DATA.project().getOwner())) .thenReturn(expected); - List actual = sprintController.getSprintsOnPage(page, ADD_SPRINT_DATA.project().getOwner()); + List actual = sprintController.getSprintsOnPage(page, ADD_SPRINT_DATA.project().getProjectId(), + ADD_SPRINT_DATA.project().getOwner()); // then assertEquals(expected, actual, SPRINT_RESPONSE_SHOULD_BE_EQUAL_TO_EXPECTED); @@ -85,10 +87,12 @@ final void test_updateSprintsName_shouldUpdateName() { SprintResponse expected = MAPPER.toSprintResponse(ADD_SPRINT_DATA.asSprint()); // when - when(sprintService.updateSprintsName(ADD_SPRINT_DATA.name(), ADD_SPRINT_DATA.asSprint().getSprintId())) + when(sprintService.updateSprintsName(ADD_SPRINT_DATA.name(), + ADD_SPRINT_DATA.asSprint().getSprintId(), ADD_SPRINT_DATA.project().getOwner())) .thenReturn(expected); - SprintResponse actual = sprintController.updateSprintsName(ADD_SPRINT_DATA.name(), ADD_SPRINT_DATA.asSprint().getSprintId()); + SprintResponse actual = sprintController.updateSprintsName(ADD_SPRINT_DATA.name(), + ADD_SPRINT_DATA.asSprint().getSprintId(), ADD_SPRINT_DATA.project().getOwner()); // then assertEquals(expected, actual, SPRINT_RESPONSE_SHOULD_BE_EQUAL_TO_EXPECTED); @@ -100,10 +104,12 @@ final void test_updateSprintsDescription_shouldUpdateDescription() { SprintResponse expected = MAPPER.toSprintResponse(ADD_SPRINT_DATA.asSprint()); // when - when(sprintService.updateSprintsDescription(ADD_SPRINT_DATA.description(), ADD_SPRINT_DATA.asSprint().getSprintId())) + when(sprintService.updateSprintsDescription(ADD_SPRINT_DATA.description(), + ADD_SPRINT_DATA.asSprint().getSprintId(), ADD_SPRINT_DATA.project().getOwner())) .thenReturn(expected); - SprintResponse actual = sprintController.updateSprintsDescription(ADD_SPRINT_DATA.description(), ADD_SPRINT_DATA.asSprint().getSprintId()); + SprintResponse actual = sprintController.updateSprintsDescription(ADD_SPRINT_DATA.description(), + ADD_SPRINT_DATA.asSprint().getSprintId(), ADD_SPRINT_DATA.project().getOwner()); // then assertEquals(expected, actual, SPRINT_RESPONSE_SHOULD_BE_EQUAL_TO_EXPECTED); @@ -115,10 +121,12 @@ final void test_updateSprintsStartDate_shouldUpdateStartDate() { SprintResponse expected = MAPPER.toSprintResponse(ADD_SPRINT_DATA.asSprint()); // when - when(sprintService.updateSprintsStartDate(ADD_SPRINT_DATA.startDate(), ADD_SPRINT_DATA.asSprint().getSprintId())) + when(sprintService.updateSprintsStartDate(ADD_SPRINT_DATA.startDate(), + ADD_SPRINT_DATA.asSprint().getSprintId(), ADD_SPRINT_DATA.project().getOwner())) .thenReturn(expected); - SprintResponse actual = sprintController.updateSprintsStartDate(ADD_SPRINT_DATA.startDate(), ADD_SPRINT_DATA.asSprint().getSprintId()); + SprintResponse actual = sprintController.updateSprintsStartDate(ADD_SPRINT_DATA.startDate(), + ADD_SPRINT_DATA.asSprint().getSprintId(), ADD_SPRINT_DATA.project().getOwner()); // then assertEquals(expected, actual, SPRINT_RESPONSE_SHOULD_BE_EQUAL_TO_EXPECTED); @@ -130,10 +138,12 @@ final void test_updateSprintsEndDate_shouldUpdateEndDate() { SprintResponse expected = MAPPER.toSprintResponse(ADD_SPRINT_DATA.asSprint()); // when - when(sprintService.updateSprintsEndDate(ADD_SPRINT_DATA.endDate(), ADD_SPRINT_DATA.asSprint().getSprintId())) + when(sprintService.updateSprintsEndDate(ADD_SPRINT_DATA.endDate(), + ADD_SPRINT_DATA.asSprint().getSprintId(), ADD_SPRINT_DATA.project().getOwner())) .thenReturn(expected); - SprintResponse actual = sprintController.updateSprintsEndDate(ADD_SPRINT_DATA.endDate(), ADD_SPRINT_DATA.asSprint().getSprintId()); + SprintResponse actual = sprintController.updateSprintsEndDate(ADD_SPRINT_DATA.endDate(), + ADD_SPRINT_DATA.asSprint().getSprintId(), ADD_SPRINT_DATA.project().getOwner()); // then assertEquals(expected, actual, SPRINT_RESPONSE_SHOULD_BE_EQUAL_TO_EXPECTED); @@ -146,10 +156,10 @@ final void test_deleteSprint_shouldDeleteSprint() { long sprintId = ADD_SPRINT_DATA.asSprint().getSprintId(); // when - when(sprintService.deleteSprint(sprintId)) + when(sprintService.deleteSprint(sprintId, ADD_SPRINT_DATA.project().getOwner())) .thenReturn(expected); - SprintResponse actual = sprintController.deleteSprint(sprintId); + SprintResponse actual = sprintController.deleteSprint(sprintId, ADD_SPRINT_DATA.project().getOwner()); // then assertEquals(expected, actual, SPRINT_RESPONSE_SHOULD_BE_EQUAL_TO_EXPECTED); diff --git a/corn-backend/src/test/java/dev/corn/cornbackend/api/sprint/SprintServiceTest.java b/corn-backend/src/test/java/dev/corn/cornbackend/api/sprint/SprintServiceTest.java index 373c7d45..fbd7167d 100644 --- a/corn-backend/src/test/java/dev/corn/cornbackend/api/sprint/SprintServiceTest.java +++ b/corn-backend/src/test/java/dev/corn/cornbackend/api/sprint/SprintServiceTest.java @@ -10,7 +10,6 @@ import dev.corn.cornbackend.utils.exceptions.sprint.SprintDoesNotExistException; import dev.corn.cornbackend.utils.exceptions.sprint.SprintEndDateMustBeAfterStartDate; import org.junit.jupiter.api.Test; -import org.mapstruct.factory.Mappers; import org.mockito.InjectMocks; import org.mockito.Mock; import org.springframework.boot.test.context.SpringBootTest; @@ -19,7 +18,6 @@ import org.springframework.data.domain.Pageable; import java.time.LocalDate; -import java.util.Collections; import java.util.List; import java.util.Optional; @@ -59,7 +57,8 @@ final void test_addNewSprint_shouldAddNewSprint() { ADD_SPRINT_DATA.name(), ADD_SPRINT_DATA.startDate(), ADD_SPRINT_DATA.endDate(), - ADD_SPRINT_DATA.description() + ADD_SPRINT_DATA.description(), + ADD_SPRINT_DATA.project().getOwner() ); // then @@ -83,7 +82,8 @@ final void test_addNewSprint_shouldThrowWhenEndIsBeforeStart() { ADD_SPRINT_DATA.name(), ADD_SPRINT_DATA.endDate(), ADD_SPRINT_DATA.startDate(), - ADD_SPRINT_DATA.description() + ADD_SPRINT_DATA.description(), + ADD_SPRINT_DATA.project().getOwner() ), "Should throw SprintDoesNotExistException"); } @@ -114,13 +114,14 @@ final void test_getSprintsOnPage_shouldGetSprintsOnPage() { Pageable pageable = PageRequest.of(page, SprintServiceImpl.SPRINTS_PER_PAGE); // when - when(sprintRepository.findAllByOwnerOrderByName(user, pageable)) + when(sprintRepository.findAllByProjectId(ADD_SPRINT_DATA.project().getProjectId(), pageable)) .thenReturn(new PageImpl<>(List.of(ADD_SPRINT_DATA.asSprint()))); SprintResponse response = new SprintResponse(0, 0, null, null, null, null); when(MAPPER.toSprintResponse(ADD_SPRINT_DATA.asSprint())) .thenReturn(response); - List actual = sprintService.getSprintsOnPage(page, user); + List actual = sprintService.getSprintsOnPage(page, ADD_SPRINT_DATA.project().getProjectId(), + ADD_SPRINT_DATA.project().getOwner()); // then assertEquals(List.of(response), actual, "List of SprintResponse should not be empty"); @@ -138,7 +139,7 @@ final void test_updateSprintsName_shouldThrowSprintDoesNotExistException() { // then assertThrows(SprintDoesNotExistException.class, - () -> sprintService.updateSprintsName(newName, sprintId), + () -> sprintService.updateSprintsName(newName, sprintId, ADD_SPRINT_DATA.project().getOwner()), SHOULD_THROW_SPRINT_DOES_NOT_EXIST_EXCEPTION); } @@ -157,7 +158,7 @@ final void test_updateSprintsName_shouldUpdateSprintsName() { when(MAPPER.toSprintResponse(ADD_SPRINT_DATA.asSprint())) .thenReturn(expected); - SprintResponse actual = sprintService.updateSprintsName(newName, sprintId); + SprintResponse actual = sprintService.updateSprintsName(newName, sprintId, ADD_SPRINT_DATA.project().getOwner()); // then assertEquals(expected, actual, SPRINT_RESPONSE_SHOULD_BE_EQUAL_TO_EXPECTED); @@ -175,7 +176,7 @@ final void test_updateSprintsDescription_shouldThrowSprintDoesNotExistException( // then assertThrows(SprintDoesNotExistException.class, - () -> sprintService.updateSprintsDescription(newDescription, sprintId), + () -> sprintService.updateSprintsDescription(newDescription, sprintId, ADD_SPRINT_DATA.project().getOwner()), SHOULD_THROW_SPRINT_DOES_NOT_EXIST_EXCEPTION); } @@ -194,7 +195,7 @@ final void test_updateSprintsDescription_shouldUpdateSprintsDescription() { when(MAPPER.toSprintResponse(ADD_SPRINT_DATA.asSprint())) .thenReturn(expected); - SprintResponse actual = sprintService.updateSprintsDescription(newDescription, sprintId); + SprintResponse actual = sprintService.updateSprintsDescription(newDescription, sprintId, ADD_SPRINT_DATA.project().getOwner()); // then assertEquals(expected, actual, SPRINT_RESPONSE_SHOULD_BE_EQUAL_TO_EXPECTED); @@ -212,7 +213,7 @@ final void test_updateSprintsStartDate_shouldThrowSprintDoesNotExistException() // then assertThrows(SprintDoesNotExistException.class, - () -> sprintService.updateSprintsStartDate(newStartDate, sprintId), + () -> sprintService.updateSprintsStartDate(newStartDate, sprintId, ADD_SPRINT_DATA.project().getOwner()), SHOULD_THROW_SPRINT_DOES_NOT_EXIST_EXCEPTION); } @@ -228,7 +229,7 @@ final void test_updateSprintsStartDate_shouldThrowWhenEndIsBeforeStart() { // then assertThrows(SprintEndDateMustBeAfterStartDate.class, - () -> sprintService.updateSprintsStartDate(newStartDate, sprint.getSprintId()), + () -> sprintService.updateSprintsStartDate(newStartDate, sprint.getSprintId(), ADD_SPRINT_DATA.project().getOwner()), SHOULD_THROW_SPRINT_DOES_NOT_EXIST_EXCEPTION); } @@ -247,7 +248,7 @@ final void test_updateSprintsStartDate_shouldUpdateSprintsStartDate() { when(MAPPER.toSprintResponse(ADD_SPRINT_DATA.asSprint())) .thenReturn(expected); - SprintResponse actual = sprintService.updateSprintsStartDate(newStartDate, sprintId); + SprintResponse actual = sprintService.updateSprintsStartDate(newStartDate, sprintId, ADD_SPRINT_DATA.project().getOwner()); // then assertEquals(expected, actual, SPRINT_RESPONSE_SHOULD_BE_EQUAL_TO_EXPECTED); @@ -265,7 +266,7 @@ final void test_updateSprintsEndDate_shouldThrowSprintDoesNotExistException() { // then assertThrows(SprintDoesNotExistException.class, - () -> sprintService.updateSprintsEndDate(newEndDate, sprintId), + () -> sprintService.updateSprintsEndDate(newEndDate, sprintId, ADD_SPRINT_DATA.project().getOwner()), "Should throw SprintDoesNotExistException"); } @@ -281,7 +282,7 @@ final void test_updateSprintsEndDate_shouldThrowWhenEndIsBeforeStart() { // then assertThrows(SprintEndDateMustBeAfterStartDate.class, - () -> sprintService.updateSprintsEndDate(newEndDate, sprint.getSprintId()), + () -> sprintService.updateSprintsEndDate(newEndDate, sprint.getSprintId(), ADD_SPRINT_DATA.project().getOwner()), "Should throw SprintDoesNotExistException"); } @@ -300,7 +301,7 @@ final void test_updateSprintsEndDate_shouldUpdateSprintsEndDate() { when(MAPPER.toSprintResponse(ADD_SPRINT_DATA.asSprint())) .thenReturn(expected); - SprintResponse actual = sprintService.updateSprintsEndDate(newEndDate, sprintId); + SprintResponse actual = sprintService.updateSprintsEndDate(newEndDate, sprintId, ADD_SPRINT_DATA.project().getOwner()); // then assertEquals(expected, actual, SPRINT_RESPONSE_SHOULD_BE_EQUAL_TO_EXPECTED); @@ -317,7 +318,7 @@ final void test_deleteSprint_shouldThrowSprintDoesNotExistException() { // then assertThrows(SprintDoesNotExistException.class, - () -> sprintService.deleteSprint(sprintId), + () -> sprintService.deleteSprint(sprintId, ADD_SPRINT_DATA.project().getOwner()), SHOULD_THROW_SPRINT_DOES_NOT_EXIST_EXCEPTION); } @@ -333,7 +334,7 @@ final void test_deleteSprint_shouldDeleteSprint() { when(MAPPER.toSprintResponse(ADD_SPRINT_DATA.asSprint())) .thenReturn(expected); - SprintResponse actual = sprintService.deleteSprint(sprintId); + SprintResponse actual = sprintService.deleteSprint(sprintId, ADD_SPRINT_DATA.project().getOwner()); // then assertEquals(expected, actual, SPRINT_RESPONSE_SHOULD_BE_EQUAL_TO_EXPECTED);