Handling of OutOfRange in ReadJson

Currently readJsonPatch returns `PropertValueNotInList` in case when an
input integer is out of range.  This change is to return
`PropertyValueOutOfRange` for the case out-of-range integer input.

Tested:

- Verify PATCH with an out-of-value integer. e.g.
```
$ curl -k -X PATCH https://${bmc}/redfish/v1/EventService/  -H "Content-Type: application/json" -d '{ "DeliveryRetryIntervalSeconds" : 4294967296}'
```

Before the change, its `MessageId` is `PropertyValueNotInList`.
```
 "Message": "The value '4294967296' for the property DeliveryRetryIntervalSeconds is not in the list of acceptable values.",
 "MessageId": "Base.1.19.0.PropertyValueNotInList",
 "MessageSeverity": "Warning",
 "Resolution": "Choose a value from the enumeration list that the implementation can support and resubmit the request if the operation failed."
```

After the change, its `MessageId` will be `PropertyValueOutOfRange`.

```
 "Message": "The value '4294967296' for the property DeliveryRetryIntervalSeconds is not in the supported range of acceptable values.",
 "MessageId": "Base.1.19.0.PropertyValueOutOfRange",
 "MessageSeverity": "Warning",
 "Resolution": "Correct the value for the property in the request body and resubmit the request if the operation failed."
```

- Redfish Service Validator passes

Change-Id: I0d0c5ecbc9f416b68fa7c0e81a0ea896ec2e50af
Signed-off-by: Myung Bae <myungbae@us.ibm.com>
diff --git a/redfish-core/include/utils/json_utils.hpp b/redfish-core/include/utils/json_utils.hpp
index 4339e90..9748b7b 100644
--- a/redfish-core/include/utils/json_utils.hpp
+++ b/redfish-core/include/utils/json_utils.hpp
@@ -330,7 +330,7 @@
             }
             else if (ec == UnpackErrorCode::outOfRange)
             {
-                messages::propertyValueNotInList(res, jsonValue, key);
+                messages::propertyValueOutOfRange(res, jsonValue, key);
             }
             return false;
         }
@@ -346,7 +346,7 @@
             }
             else if (ec == UnpackErrorCode::outOfRange)
             {
-                messages::propertyValueNotInList(res, jsonValue, key);
+                messages::propertyValueOutOfRange(res, jsonValue, key);
             }
             return false;
         }
diff --git a/test/redfish-core/include/utils/json_utils_test.cpp b/test/redfish-core/include/utils/json_utils_test.cpp
index 0f87647..3daa479 100644
--- a/test/redfish-core/include/utils/json_utils_test.cpp
+++ b/test/redfish-core/include/utils/json_utils_test.cpp
@@ -371,6 +371,27 @@
     EXPECT_THAT(res.jsonValue, Not(IsEmpty()));
 }
 
+TEST(ReadJsonPatch, VerifyReadJsonPatchIntegerReturnsOutOfRange)
+{
+    crow::Response res;
+    std::error_code ec;
+
+    // 4294967296 is an out-of-range value for uint32_t
+    crow::Request req(R"({"@odata.etag": "etag", "integer": 4294967296})", ec);
+    req.addHeader(boost::beast::http::field::content_type, "application/json");
+
+    uint32_t integer = 0;
+    ASSERT_FALSE(readJsonPatch(req, res, "integer", integer));
+    EXPECT_EQ(res.result(), boost::beast::http::status::bad_request);
+
+    const nlohmann::json& resExtInfo =
+        res.jsonValue["error"]["@Message.ExtendedInfo"];
+    EXPECT_THAT(resExtInfo[0]["@odata.type"], "#Message.v1_1_1.Message");
+    EXPECT_THAT(resExtInfo[0]["MessageId"],
+                "Base.1.19.0.PropertyValueOutOfRange");
+    EXPECT_THAT(resExtInfo[0]["MessageSeverity"], "Warning");
+}
+
 TEST(ReadJsonAction, ValidElementsReturnsTrueResponseOkValuesUnpackedCorrectly)
 {
     crow::Response res;