# specs/features/UC004-update-task.feature # # SINGLE SOURCE OF TRUTH for UC004 behaviour. # This file is: # (1) referenced by specs/use_cases/UC004-update-task.md (documentation) # (2) executed by the acceptance test suite (living documentation) # # Rules: # - Scenario IDs (e.g. UC004-S01) must match the use case document. # - Step definitions live in: src/test/java/.../steps/ # - Keep scenarios focused: one behaviour per scenario. # - Use exact terms from specs/glossary.md. Feature: Update Task As a User I want to update an existing Task So that I can change its title, description, status, or due date Background: Given a task exists with title "Fix login bug", status "TODO", and id stored as "existingTaskId" # --------------------------------------------------------------------------- # Happy path # --------------------------------------------------------------------------- Scenario: UC004-S01 Successfully update all fields of an existing task When the User updates task "existingTaskId" with title "Fixed login bug", description "Resolved", status "DONE", and due date "2026-04-01" Then the response status is 200 And the response contains a task with title "Fixed login bug" And the response contains a task with description "Resolved" And the response contains a task with status "DONE" And the response contains a task with due date "2026-04-01" And the response contains a task with id "existingTaskId" Scenario: UC004-S02 Successfully change the status of a task via update When the User updates task "existingTaskId" with title "Fix login bug", status "IN_PROGRESS" Then the response status is 200 And the response contains a task with status "IN_PROGRESS" # --------------------------------------------------------------------------- # Not found # --------------------------------------------------------------------------- Scenario: UC004-S03 Return 404 when updating a non-existent task When the User updates task 999999 with title "Anything", status "TODO" Then the response status is 404 And the response error code is "TASK_NOT_FOUND" # --------------------------------------------------------------------------- # Validation — BR-001, BR-002, BR-003, BR-006 # --------------------------------------------------------------------------- Scenario: UC004-S04 Reject update when title is blank When the User updates task "existingTaskId" with title "" and status "TODO" Then the response status is 400 And the response error code is "TASK_TITLE_REQUIRED" Scenario: UC004-S05 Reject update when title exceeds 100 characters When the User updates task "existingTaskId" with a title of 101 characters and status "TODO" Then the response status is 400 And the response error code is "TASK_TITLE_TOO_LONG" Scenario: UC004-S06 Reject update when description exceeds 500 characters When the User updates task "existingTaskId" with title "Valid title", a description of 501 characters, and status "TODO" Then the response status is 400 And the response error code is "TASK_DESCRIPTION_TOO_LONG" Scenario: UC004-S07 Reject update when due date is invalid When the User updates task "existingTaskId" with title "Valid title", status "TODO", and due date "not-a-date" Then the response status is 400 And the response error code is "TASK_DUE_DATE_INVALID" # --------------------------------------------------------------------------- # BR-005: Task ID is immutable # --------------------------------------------------------------------------- Scenario: UC004-S08 Task ID is not changed by an update When the User updates task "existingTaskId" with title "Updated title", status "IN_PROGRESS" Then the response status is 200 And the response contains a task with id "existingTaskId"