### Question:
RewriterUtils { public static boolean isHtml(HttpRequest request, HttpResponse original) { String mimeType = getMimeType(request, original); return mimeType != null && (mimeType.contains("html")); } private  RewriterUtils(); static boolean isHtml(HttpRequest request, HttpResponse original); static boolean isHtml(HttpRequest request, HttpResponseBuilder original); static boolean maybeAcceptHtml(@Nullable String htmlTagName); static boolean isCss(HttpRequest request, HttpResponse original); static boolean isCss(HttpRequest request, HttpResponseBuilder original); static boolean isJavascript(HttpRequest request, HttpResponse original); static boolean isJavascript(HttpRequest request, HttpResponseBuilder original); static String getMimeType(HttpRequest request, HttpResponse original); static String getMimeType(HttpRequest request, HttpResponseBuilder original);  }### Answer:
@Test public void testIsHtmlWithoutHtmlTagContext() throws Exception { HttpRequest req = new HttpRequest(Uri.parse("http: HttpResponseBuilder builder = new HttpResponseBuilder() .addHeader("Content-Type", "text/html"); assertTrue(RewriterUtils.isHtml(req, builder)); }
@Test public void testIsHtmlReturnsFalseIfNonHtmlTagContext() throws Exception { HttpRequest req = new HttpRequest(Uri.parse("http: req.setParam(UriCommon.Param.HTML_TAG_CONTEXT.getKey(), "script"); HttpResponseBuilder builder = new HttpResponseBuilder() .addHeader("Content-Type", "text/html"); assertFalse(RewriterUtils.isHtml(req, builder)); }
@Test public void testIsHtmlReturnsTrueIfHtmlAcceptingTagContext() throws Exception { HttpRequest req = new HttpRequest(Uri.parse("http: req.setParam(UriCommon.Param.HTML_TAG_CONTEXT.getKey(), "link"); HttpResponseBuilder builder = new HttpResponseBuilder() .addHeader("Content-Type", "text/html"); assertTrue(RewriterUtils.isHtml(req, builder)); req.setParam(UriCommon.Param.HTML_TAG_CONTEXT.getKey(), "iframe"); assertTrue(RewriterUtils.isHtml(req, builder)); }