Class MockInterceptor

  • All Implemented Interfaces:
    okhttp3.Interceptor

    public class MockInterceptor
    extends Object
    implements okhttp3.Interceptor
    A MockInterceptor object is used to mock the responses for testing purposes.
    • Field Detail

      • request

        public okhttp3.Request request
    • Constructor Detail

      • MockInterceptor

        public MockInterceptor​(okhttp3.MediaType mediaType,
                               Integer responseCode)
    • Method Detail

      • intercept

        public okhttp3.Response intercept​(okhttp3.Interceptor.Chain chain)
                                   throws IOException
        Specified by:
        intercept in interface okhttp3.Interceptor
        Throws:
        IOException
      • getSampleResponse

        public String getSampleResponse()
      • setSampleResponse

        public void setSampleResponse​(String sampleResponse)
      • getRequest

        public okhttp3.Request getRequest()
      • setRequest

        public void setRequest​(okhttp3.Request request)
      • getMediaType

        public okhttp3.MediaType getMediaType()
      • setMediaType

        public void setMediaType​(okhttp3.MediaType mediaType)
      • getResponseCode

        public Integer getResponseCode()
      • setResponseCode

        public void setResponseCode​(Integer responseCode)