### Question:
HttpUtils { public static boolean followRedirect(AsyncHttpClientConfig config, Request request) { return request.getFollowRedirect() != null ? request.getFollowRedirect() : config.isFollowRedirect(); } private  HttpUtils(); static String hostHeader(Uri uri); static String originHeader(Uri uri); static Charset extractContentTypeCharsetAttribute(String contentType); static String extractContentTypeBoundaryAttribute(String contentType); static byte[] computeMultipartBoundary(); static String patchContentTypeWithBoundaryAttribute(CharSequence base, byte[] boundary); static boolean followRedirect(AsyncHttpClientConfig config, Request request); static ByteBuffer urlEncodeFormParams(List<Param> params, Charset charset); static CharSequence filterOutBrotliFromAcceptEncoding(String acceptEncoding); static final AsciiString ACCEPT_ALL_HEADER_VALUE; static final AsciiString GZIP_DEFLATE; }### Answer:
@Test public void testDefaultFollowRedirect() { Request request = Dsl.get("http: DefaultAsyncHttpClientConfig config = new DefaultAsyncHttpClientConfig.Builder().build(); boolean followRedirect = HttpUtils.followRedirect(config, request); assertFalse(followRedirect, "Default value of redirect should be false"); }
@Test public void testGetFollowRedirectInRequest() { Request request = Dsl.get("http: DefaultAsyncHttpClientConfig config = new DefaultAsyncHttpClientConfig.Builder().build(); boolean followRedirect = HttpUtils.followRedirect(config, request); assertTrue(followRedirect, "Follow redirect must be true as set in the request"); }
@Test public void testGetFollowRedirectInConfig() { Request request = Dsl.get("http: DefaultAsyncHttpClientConfig config = new DefaultAsyncHttpClientConfig.Builder().setFollowRedirect(true).build(); boolean followRedirect = HttpUtils.followRedirect(config, request); assertTrue(followRedirect, "Follow redirect should be equal to value specified in config when not specified in request"); }
@Test public void testGetFollowRedirectPriorityGivenToRequest() { Request request = Dsl.get("http: DefaultAsyncHttpClientConfig config = new DefaultAsyncHttpClientConfig.Builder().setFollowRedirect(true).build(); boolean followRedirect = HttpUtils.followRedirect(config, request); assertFalse(followRedirect, "Follow redirect value set in request should be given priority"); }