Class JsonErrorResponse


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

      Constructors 
      Constructor Description
      JsonErrorResponse​(org.apache.olingo.odata2.api.commons.HttpStatusCodes status, JsonObject json)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static JsonErrorResponse createFrom​(org.apache.olingo.odata2.api.processor.ODataResponse response)
      Creates this error response
      java.lang.String getErrorCode()
      Retrieves error code reported in the response body.
      java.lang.String getMessage()
      Retrieves error message reported in the response body.
      int getStatusCode()
      Retrieves HTTP status code of the response.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JsonErrorResponse

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

      • 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 java.lang.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 java.lang.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.