Class JsonErrorResponse

java.lang.Object
de.hybris.platform.odata2services.util.JsonErrorResponse

public class JsonErrorResponse extends Object
A helper class for simpler evaluation of error reponses in the tests.
  • Constructor Details

    • JsonErrorResponse

      public JsonErrorResponse(org.apache.olingo.odata2.api.commons.HttpStatusCodes status, JsonObject json)
  • Method Details

    • createFrom

      public static JsonErrorResponse createFrom(org.apache.olingo.odata2.api.processor.ODataResponse response) throws org.apache.olingo.odata2.api.exception.ODataException
      Creates this error response
      Parameters:
      response - OData2 response received in the test
      Throws:
      org.apache.olingo.odata2.api.exception.ODataException - if response body cannot be read
    • getStatusCode

      public int getStatusCode()
      Retrieves HTTP status code of the response.
      Returns:
      HTTP status code even, if response is not error but is successful
    • getErrorCode

      public String getErrorCode()
      Retrieves error code reported in the response body.
      Returns:
      value of the "error.code" path in the response body or null, if error code is not present in the response body.
    • getMessage

      public String getMessage()
      Retrieves error message reported in the response body.
      Returns:
      value of the "error.message.value" path in the response body or null, if error message is not present in the body.