./gradlew bootRun
./gradlew test
curl --location --request POST 'localhost:8080/api/manager/bookrooms' \
--header 'Content-Type: application/json' \
--data-raw '{
"economyRooms": 3,
"premiumRooms": 3,
"customersBudgets": [23, 45, 155, 374, 22, 99.99, 100, 101, 115, 209]
}'
- negative number of free rooms
curl --location --request POST 'localhost:8080/api/manager/bookrooms' \
--header 'Content-Type: application/json' \
--data-raw '{
"economyRooms": -1,
"premiumRooms": 3,
"customersBudgets": [23, 45, 155, 374, 22, 99.99, 100, 101, 115, 209]
}'
{
"codes": [
"Min.roomOccupancyRequestDto.economyRooms",
"Min.economyRooms",
"Min.java.lang.Integer",
"Min"
],
"arguments": [
{
"codes": [
"roomOccupancyRequestDto.economyRooms",
"economyRooms"
],
"arguments": null,
"defaultMessage": "economyRooms",
"code": "economyRooms"
},
0
],
"defaultMessage": "The value must be positive",
"objectName": "roomOccupancyRequestDto",
"field": "economyRooms",
"rejectedValue": -1,
"bindingFailure": false,
"code": "Min"
}
- empty customer budgets section
curl --location --request POST 'localhost:8080/api/manager/bookrooms' \
--header 'Content-Type: application/json' \
--data-raw '{
"economyRooms": 1,
"premiumRooms": 3,
"customersBudgets": []
}'
{
"codes": [
"NotEmpty.roomOccupancyRequestDto.customersBudgets",
"NotEmpty.customersBudgets",
"NotEmpty.java.util.List",
"NotEmpty"
],
"arguments": [
{
"codes": [
"roomOccupancyRequestDto.customersBudgets",
"customersBudgets"
],
"arguments": null,
"defaultMessage": "customersBudgets",
"code": "customersBudgets"
}
],
"defaultMessage": "Customer budgets are empty",
"objectName": "roomOccupancyRequestDto",
"field": "customersBudgets",
"rejectedValue": [],
"bindingFailure": false,
"code": "NotEmpty"
}
response message, currency and threshold between economy and premium are customizable by editing application.properties file