Summary| Tags| Feature: api/event-validation-negative/event-validation-negative.feature| Ticketing MVP - Event Validation Negative Paths As a system admin I want validation errors when creating events with invalid data So that data integrity is maintained
Scenario: [1:12] Scenario 1 - Capacity exceeds room maxCapacity
ms: 28
>>
Background:
7
* def baseUrlEvents = karate.properties['baseUrlEvents'] || 'http://localhost:8081'
1
22:50:37.977 karate.env system property was: null
8
* def UUID = Java.type('java.util.UUID')
0
9
* def eventTitle = 'Negative Test Event ' + java.lang.System.currentTimeMillis()
3
10
* def futureDate = '2026-12-15T20:00:00'
0
# HU-01 Negative: Capacity > maxCapacity should be rejected
# Setup: Create room with maxCapacity=50
16
Given url baseUrlEvents + '/api/v1/rooms'
0
17
And header X-Role = 'ADMIN'
0
18
And header X-User-Id = '00000000-0000-0000-0000-000000000001'
0
19
And request
0
{ "name": "Small Room for Negative Test", "maxCapacity": 50 }
26
When method post
13
22:50:37.984 request: 1 > POST http://localhost:8081/api/v1/rooms 1 > X-Role: ADMIN 1 > X-User-Id: 00000000-0000-0000-0000-000000000001 1 > Content-Type: application/json; charset=UTF-8 1 > Content-Length: 56 1 > Host: localhost:8081 1 > Connection: Keep-Alive 1 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.17) 1 > Accept-Encoding: gzip,deflate {"name":"Small Room for Negative Test","maxCapacity":50} 22:50:37.996 response time in milliseconds: 12 1 < 201 1 < Content-Type: application/json 1 < Transfer-Encoding: chunked 1 < Date: Wed, 08 Apr 2026 03:50:37 GMT 1 < Keep-Alive: timeout=60 1 < Connection: keep-alive {"id":"1392b577-2965-4c90-9f52-1ae88aa2c829","name":"Small Room for Negative Test","maxCapacity":50,"created_at":"2026-04-08T03:50:37.986943078","updated_at":"2026-04-08T03:50:37.986959376"}
27
Then status 201
0
28
* def roomId = response.id ? response.id : response.roomId
0
29
* print 'Room created with maxCapacity=50:', roomId
0
22:50:37.997 [print] Room created with maxCapacity=50: 1392b577-2965-4c90-9f52-1ae88aa2c829
# HU-01 Negative: Attempt to create event with capacity=100 (exceeds maxCapacity=50)
32
Given url baseUrlEvents + '/api/v1/events'
0
33
And header X-Role = 'ADMIN'
0
34
And header X-User-Id = '00000000-0000-0000-0000-000000000001'
0
35
And request
1
{ "roomId": "#(roomId)", "title": "#(eventTitle) - Capacity Overflow", "description": "Test event with capacity exceeding room max", "date": "#(futureDate)", "capacity": 100, "enableSeats": false }
46
When method post
8
22:50:37.999 request: 2 > POST http://localhost:8081/api/v1/events 2 > X-Role: ADMIN 2 > X-User-Id: 00000000-0000-0000-0000-000000000001 2 > Content-Type: application/json; charset=UTF-8 2 > Content-Length: 217 2 > Host: localhost:8081 2 > Connection: Keep-Alive 2 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.17) 2 > Accept-Encoding: gzip,deflate {"roomId":"1392b577-2965-4c90-9f52-1ae88aa2c829","title":"#(eventTitle) - Capacity Overflow","description":"Test event with capacity exceeding room max","date":"2026-12-15T20:00:00","capacity":100,"enableSeats":false} 22:50:38.006 response time in milliseconds: 6 2 < 400 2 < Content-Type: application/json 2 < Transfer-Encoding: chunked 2 < Date: Wed, 08 Apr 2026 03:50:37 GMT 2 < Connection: close {"error":"CAPACITY_EXCEEDS_MAXIMUM","message":"Capacity exceeds maximum allowed for this room","roomMaxCapacity":50}
47
Then status 400
0
48
* print 'Request rejected 400 - capacity exceeds maxCapacity (expected)'
1
22:50:38.007 [print] Request rejected 400 - capacity exceeds maxCapacity (expected)
Scenario: [2:51] Scenario 2 - Missing required field: date
ms: 28
>>
Background:
7
* def baseUrlEvents = karate.properties['baseUrlEvents'] || 'http://localhost:8081'
0
22:50:38.010 karate.env system property was: null
8
* def UUID = Java.type('java.util.UUID')
0
9
* def eventTitle = 'Negative Test Event ' + java.lang.System.currentTimeMillis()
1
10
* def futureDate = '2026-12-15T20:00:00'
0
# HU-01 Negative: Missing date should be rejected
# Setup: Create room
55
Given url baseUrlEvents + '/api/v1/rooms'
0
56
And header X-Role = 'ADMIN'
0
57
And header X-User-Id = '00000000-0000-0000-0000-000000000001'
0
58
And request
0
{ "name": "Room for Missing Date Test", "maxCapacity": 100 }
65
When method post
12
22:50:38.014 request: 1 > POST http://localhost:8081/api/v1/rooms 1 > X-Role: ADMIN 1 > X-User-Id: 00000000-0000-0000-0000-000000000001 1 > Content-Type: application/json; charset=UTF-8 1 > Content-Length: 55 1 > Host: localhost:8081 1 > Connection: Keep-Alive 1 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.17) 1 > Accept-Encoding: gzip,deflate {"name":"Room for Missing Date Test","maxCapacity":100} 22:50:38.024 response time in milliseconds: 10 1 < 201 1 < Content-Type: application/json 1 < Transfer-Encoding: chunked 1 < Date: Wed, 08 Apr 2026 03:50:37 GMT 1 < Keep-Alive: timeout=60 1 < Connection: keep-alive {"id":"303dee73-c02a-482f-af4e-61502963b1b5","name":"Room for Missing Date Test","maxCapacity":100,"created_at":"2026-04-08T03:50:38.017558572","updated_at":"2026-04-08T03:50:38.017576829"}
66
Then status 201
0
67
* def roomId = response.id ? response.id : response.roomId
0
68
* print 'Room created:', roomId
1
22:50:38.026 [print] Room created: 303dee73-c02a-482f-af4e-61502963b1b5
# HU-01 Negative: Attempt to create event WITHOUT date
71
Given url baseUrlEvents + '/api/v1/events'
0
72
And header X-Role = 'ADMIN'
0
73
And header X-User-Id = '00000000-0000-0000-0000-000000000001'
0
74
And request
0
{ "roomId": "#(roomId)", "title": "#(eventTitle) - No Date", "description": "Test event without date field", "capacity": 50, "enableSeats": false }
84
When method post
13
22:50:38.028 request: 2 > POST http://localhost:8081/api/v1/events 2 > X-Role: ADMIN 2 > X-User-Id: 00000000-0000-0000-0000-000000000001 2 > Content-Type: application/json; charset=UTF-8 2 > Content-Length: 163 2 > Host: localhost:8081 2 > Connection: Keep-Alive 2 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.17) 2 > Accept-Encoding: gzip,deflate {"roomId":"303dee73-c02a-482f-af4e-61502963b1b5","title":"#(eventTitle) - No Date","description":"Test event without date field","capacity":50,"enableSeats":false} 22:50:38.039 response time in milliseconds: 11 2 < 400 2 < Content-Type: application/json 2 < Transfer-Encoding: chunked 2 < Date: Wed, 08 Apr 2026 03:50:37 GMT 2 < Connection: close {"error":"VALIDATION_ERROR","message":"Invalid request data","details":{"date":"date: must not be null"}}
85
Then status 400
0
86
* print 'Request rejected 400 - date field missing (expected)'
1
22:50:38.040 [print] Request rejected 400 - date field missing (expected)
Scenario: [3:89] Scenario 3 - Missing multiple required fields (title + date)
ms: 21
>>
Background:
7
* def baseUrlEvents = karate.properties['baseUrlEvents'] || 'http://localhost:8081'
0
22:50:38.043 karate.env system property was: null
8
* def UUID = Java.type('java.util.UUID')
0
9
* def eventTitle = 'Negative Test Event ' + java.lang.System.currentTimeMillis()
1
10
* def futureDate = '2026-12-15T20:00:00'
0
# HU-01 Negative: Missing title AND date should be rejected
# Setup: Create room
93
Given url baseUrlEvents + '/api/v1/rooms'
0
94
And header X-Role = 'ADMIN'
0
95
And header X-User-Id = '00000000-0000-0000-0000-000000000001'
0
96
And request
0
{ "name": "Room for Multiple Missing Fields Test", "maxCapacity": 150 }
103
When method post
11
22:50:38.047 request: 1 > POST http://localhost:8081/api/v1/rooms 1 > X-Role: ADMIN 1 > X-User-Id: 00000000-0000-0000-0000-000000000001 1 > Content-Type: application/json; charset=UTF-8 1 > Content-Length: 66 1 > Host: localhost:8081 1 > Connection: Keep-Alive 1 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.17) 1 > Accept-Encoding: gzip,deflate {"name":"Room for Multiple Missing Fields Test","maxCapacity":150} 22:50:38.056 response time in milliseconds: 9 1 < 201 1 < Content-Type: application/json 1 < Transfer-Encoding: chunked 1 < Date: Wed, 08 Apr 2026 03:50:37 GMT 1 < Keep-Alive: timeout=60 1 < Connection: keep-alive {"id":"2b6eb480-ecf3-40c5-82c9-fa6515409b87","name":"Room for Multiple Missing Fields Test","maxCapacity":150,"created_at":"2026-04-08T03:50:38.049677963","updated_at":"2026-04-08T03:50:38.049697645"}
104
Then status 201
0
105
* def roomId = response.id ? response.id : response.roomId
0
106
* print 'Room created:', roomId
0
22:50:38.057 [print] Room created: 2b6eb480-ecf3-40c5-82c9-fa6515409b87
# HU-01 Negative: Attempt to create event WITHOUT title and WITHOUT date
109
Given url baseUrlEvents + '/api/v1/events'
0
110
And header X-Role = 'ADMIN'
0
111
And header X-User-Id = '00000000-0000-0000-0000-000000000001'
0
112
And request
0
{ "roomId": "#(roomId)", "description": "Test event without title and date", "capacity": 75, "enableSeats": false }
121
When method post
6
22:50:38.059 request: 2 > POST http://localhost:8081/api/v1/events 2 > X-Role: ADMIN 2 > X-User-Id: 00000000-0000-0000-0000-000000000001 2 > Content-Type: application/json; charset=UTF-8 2 > Content-Length: 133 2 > Host: localhost:8081 2 > Connection: Keep-Alive 2 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.17) 2 > Accept-Encoding: gzip,deflate {"roomId":"2b6eb480-ecf3-40c5-82c9-fa6515409b87","description":"Test event without title and date","capacity":75,"enableSeats":false} 22:50:38.064 response time in milliseconds: 5 2 < 400 2 < Content-Type: application/json 2 < Transfer-Encoding: chunked 2 < Date: Wed, 08 Apr 2026 03:50:37 GMT 2 < Connection: close {"error":"VALIDATION_ERROR","message":"Invalid request data","details":{"date":"date: must not be null","title":"title: must not be blank"}}
122
Then status 400
0
123
* print 'Request rejected 400 - multiple required fields missing (expected)'
1
22:50:38.065 [print] Request rejected 400 - multiple required fields missing (expected)