Class HttpClientTests


  • public abstract class HttpClientTests
    extends java.lang.Object
    Generic test suite for HttpClients.
    • Constructor Summary

      Constructors 
      Constructor Description
      HttpClientTests()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void bomWithDifferentHeader()
      Tests that a response with a byte order marker and 'Content-Type' header will defer to using the BOM encoding.
      void bomWithSameHeader()
      Tests that a response with a byte order marker and 'Content-Type' header will defer to using the BOM encoding.
      protected abstract com.azure.android.core.http.HttpClient createHttpClient()
      Get the HTTP client that will be used for each test.
      protected abstract int getWireMockPort()
      Get the dynamic port the WireMock server is using to properly route the request.
      void headerResponse()
      Tests that a response with a 'Content-Type' header encodes using the specified charset.
      void invalidHeaderResponse()
      Tests that a response with a 'Content-Type' containing an invalid or unsupported charset encodes using UTF-8.
      void plainResponse()
      Tests that a response without a byte order mark or a 'Content-Type' header encodes using UTF-8.
      void utf16BeBomResponse()
      Tests that a response with a byte order mark encodes using the specified charset.
      void utf16LeBomResponse()
      Tests that a response with a byte order mark encodes using the specified charset.
      void utf32BeBomResponse()
      Tests that a response with a byte order mark encodes using the specified charset.
      void utf32LeBomResponse()
      Tests that a response with a byte order mark encodes using the specified charset.
      void utf8BomResponse()
      Tests that a response with a byte order mark encodes using the specified charset.
      • Methods inherited from class java.lang.Object

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

      • HttpClientTests

        public HttpClientTests()
    • Method Detail

      • createHttpClient

        protected abstract com.azure.android.core.http.HttpClient createHttpClient()
        Get the HTTP client that will be used for each test. This will be called once per test.
        Returns:
        The HTTP client to use for each test.
      • getWireMockPort

        protected abstract int getWireMockPort()
        Get the dynamic port the WireMock server is using to properly route the request.
        Returns:
        The HTTP port WireMock is using.
      • plainResponse

        @Test
        public void plainResponse()
        Tests that a response without a byte order mark or a 'Content-Type' header encodes using UTF-8.
      • headerResponse

        @Test
        public void headerResponse()
        Tests that a response with a 'Content-Type' header encodes using the specified charset.
      • invalidHeaderResponse

        @Test
        public void invalidHeaderResponse()
        Tests that a response with a 'Content-Type' containing an invalid or unsupported charset encodes using UTF-8.
      • utf8BomResponse

        @Test
        public void utf8BomResponse()
        Tests that a response with a byte order mark encodes using the specified charset.
      • utf16BeBomResponse

        @Test
        public void utf16BeBomResponse()
        Tests that a response with a byte order mark encodes using the specified charset.
      • utf16LeBomResponse

        @Test
        public void utf16LeBomResponse()
        Tests that a response with a byte order mark encodes using the specified charset.
      • utf32BeBomResponse

        @Test
        public void utf32BeBomResponse()
        Tests that a response with a byte order mark encodes using the specified charset.
      • utf32LeBomResponse

        @Test
        public void utf32LeBomResponse()
        Tests that a response with a byte order mark encodes using the specified charset.
      • bomWithSameHeader

        @Test
        public void bomWithSameHeader()
        Tests that a response with a byte order marker and 'Content-Type' header will defer to using the BOM encoding.
      • bomWithDifferentHeader

        @Test
        public void bomWithDifferentHeader()
        Tests that a response with a byte order marker and 'Content-Type' header will defer to using the BOM encoding.