+
+ +

Class HttpResourceFetcherTest

+
+
+ +
+
    +
  • +
    +
    public class HttpResourceFetcherTest
    +extends Object
    +
    Tests the inner class HttpResourceFetcher.
    +
    +
    Author:
    +
    Kai Moritz
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
    +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        HttpResourceFetcherTest

        +
        public HttpResourceFetcherTest()
        +
      • +
      +
    • +
    +
    + +
    +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        withServeStaleFalse

        +
        public void withServeStaleFalse()
        +
      • +
      + + + +
        +
      • +

        withServeStaleFalseAndMinTTL

        +
        public void withServeStaleFalseAndMinTTL()
        +
      • +
      + + + +
        +
      • +

        withServeStaleTrue

        +
        public void withServeStaleTrue()
        +
      • +
      + + + +
        +
      • +

        test_Fetch_Cached_Valid

        +
        @Test
        +@DisplayName("first request -- cached - valid")
        +public void test_Fetch_Cached_Valid()
        +                             throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Fetch_Cached_Expired

        +
        @Test
        +@DisplayName("first request -- cached - expired")
        +public void test_Fetch_Cached_Expired()
        +                               throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Fetch_Cached_NotFound

        +
        @Test
        +@DisplayName("first request -- cached - not found")
        +public void test_Fetch_Cached_NotFound()
        +                                throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Fetch_Cached_ServerError

        +
        @Test
        +@DisplayName("first request -- cached - server error")
        +public void test_Fetch_Cached_ServerError()
        +                                   throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Fetch_200_NoHeaders_NoBody

        +
        @Test
        +@DisplayName("first request -- 200 - no headers / no body")
        +public void test_Fetch_200_NoHeaders_NoBody()
        +                                     throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Fetch_200_NoHeaders

        +
        @Test
        +@DisplayName("first request -- 200 - no headers")
        +public void test_Fetch_200_NoHeaders()
        +                              throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Fetch_200_HTTP11

        +
        @Test
        +@DisplayName("first request -- 200 - HTTP/1.1")
        +public void test_Fetch_200_HTTP11()
        +                           throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Fetch_200_HTTP11_MinTTL

        +
        @Test
        +@DisplayName("first request + min-TTL -- 200 - HTTP/1.1")
        +public void test_Fetch_200_HTTP11_MinTTL()
        +                                  throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Fetch_200_HTTP11_DateMissing_

        +
        @Test
        +@DisplayName("first request -- 200 - HTTP/1.1 / Date-Header is missing")
        +public void test_Fetch_200_HTTP11_DateMissing_()
        +                                        throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Fetch_200_HTTP11_MaxAge0

        +
        @Test
        +@DisplayName("first request -- 200 - HTTP/1.1 / Cache-Control: public, max-age=0")
        +public void test_Fetch_200_HTTP11_MaxAge0()
        +                                   throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Fetch_200_HTTP11_NoCache

        +
        @Test
        +@DisplayName("first request -- 200 - HTTP/1.1 / Cache-Control: no-cache")
        +public void test_Fetch_200_HTTP11_NoCache()
        +                                   throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Fetch_200_HTTP11_NoCacheQualified

        +
        @Test
        +@DisplayName("first request -- 200 - HTTP/1.1 / Cache-Control: no-cache=\"Cookie\"")
        +public void test_Fetch_200_HTTP11_NoCacheQualified()
        +                                            throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Fetch_200_HTTP10

        +
        @Test
        +@DisplayName("first request -- 200 - HTTP/1.0")
        +public void test_Fetch_200_HTTP10()
        +                           throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Fetch_200_HTTP10_InvalidExpires

        +
        @Test
        +@DisplayName("first request -- 200 - HTTP/1.0 / invalid Expires-Header")
        +public void test_Fetch_200_HTTP10_InvalidExpires()
        +                                          throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Fetch_200_Mixed

        +
        @Test
        +@DisplayName("first request -- 200 - HTTP/mixed: Expires + Cache-Control: private")
        +public void test_Fetch_200_Mixed()
        +                          throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Fetch_200_Mixed_ExpiresOverwritten

        +
        @Test
        +@DisplayName("first request -- 200 - HTTP/mixed: Expires + Cache-Control: max-age")
        +public void test_Fetch_200_Mixed_ExpiresOverwritten()
        +                                             throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Fetch_200_HTTP11_Encoding

        +
        @Test
        +@DisplayName("first request -- 200 - HTTP/1.1 + Content-Encoding: gzip")
        +public void test_Fetch_200_HTTP11_Encoding()
        +                                    throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Fetch_200_HTTP11_MustRevalidate

        +
        @Test
        +@DisplayName("first request -- 200 - HTTP/1.1 + Cache-Control: must-revalidate")
        +public void test_Fetch_200_HTTP11_MustRevalidate()
        +                                          throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Fetch_404_HTTP11

        +
        @Test
        +@DisplayName("first request -- 400 - HTTP/1.1")
        +public void test_Fetch_404_HTTP11()
        +                           throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Fetch_404_HTTP11_Cacheable

        +
        @Test
        +@DisplayName("first request -- 404 - HTTP/1.1 + Cache-Control: max-age")
        +public void test_Fetch_404_HTTP11_Cacheable()
        +                                     throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Fetch_500_HTTP11

        +
        @Test
        +@DisplayName("first request -- 500 - HTTP/1.1")
        +public void test_Fetch_500_HTTP11()
        +                           throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Fetch_ServerDown

        +
        @Test
        +@DisplayName("first request -- server is down")
        +public void test_Fetch_ServerDown()
        +                           throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Update_Cached_Same_RequestIsExecuted

        +
        @Test
        +@DisplayName("update request -- cached - same -> request is executed")
        +public void test_Update_Cached_Same_RequestIsExecuted()
        +                                               throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Update_Cached_Valid

        +
        @Test
        +@DisplayName("update request -- cached - valid")
        +public void test_Update_Cached_Valid()
        +                              throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Update_Cached_Expired_RequestIsExecuted

        +
        @Test
        +@DisplayName("update request -- cached - expired -> request is executed")
        +public void test_Update_Cached_Expired_RequestIsExecuted()
        +                                                  throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Update_304

        +
        @Test
        +@DisplayName("update request -- 304: not modified")
        +public void test_Update_304()
        +                     throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Update_200

        +
        @Test
        +@DisplayName("update request -- 200: modified")
        +public void test_Update_200()
        +                     throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Update_404

        +
        @Test
        +@DisplayName("update request -- 404: not found")
        +public void test_Update_404()
        +                     throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Update_500

        +
        @Test
        +@DisplayName("update request -- 500: server error")
        +public void test_Update_500()
        +                     throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Update_MustRevalidate_304

        +
        @Test
        +@DisplayName("update request -- must revalidate / 304: not modified")
        +public void test_Update_MustRevalidate_304()
        +                                    throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Update_MustRevalidate_500

        +
        @Test
        +@DisplayName("update request -- must-revalidate / 500: server error")
        +public void test_Update_MustRevalidate_500()
        +                                    throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Update_404_ServeStale

        +
        @Test
        +@DisplayName("update request + serve-stale -- 404: not found")
        +public void test_Update_404_ServeStale()
        +                                throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Update_500_MustRevalidate_ServeStale

        +
        @Test
        +@DisplayName("update request + serve-stale -- must-revalidate / 500: server error")
        +public void test_Update_500_MustRevalidate_ServeStale()
        +                                               throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      + + + +
        +
      • +

        test_Update_ServerDown

        +
        @Test
        +@DisplayName("update request -- server is down")
        +public void test_Update_ServerDown()
        +                            throws Exception
        +
        +
        Throws:
        +
        Exception
        +
        +
      • +
      +
    • +
    +
    +
  • +
+
+
+