QueryServlet extends TransformationServlet { protected boolean shouldWriteQueryCookie(String queryText) { return (null == queryText || queryText.length() <= 2048); }  @Override String[] getCookieNames(); @Override void init(final ServletConfig config); @Override void destroy(); @Override final void service(final HttpServletRequest req, final HttpServletResponse resp);  }
@Test public final void testLongQuery() throws ServletException, IOException { assertThat(servlet.shouldWriteQueryCookie(longQuery)).isFalse(); }
@Test public final void testShortQuery() throws ServletException, IOException { assertThat(servlet.shouldWriteQueryCookie(SHORT_QUERY)).isTrue(); }
@Test public final void testNoQuery() throws ServletException, IOException { assertThat(servlet.shouldWriteQueryCookie(null)).isTrue(); }