RequestUtils { public static boolean isAjaxRequest(HttpServletRequest request) { String header = request.getHeader("X-Requested-With"); return "XMLHttpRequest".equals(header); } private  RequestUtils(); static boolean isAjaxRequest(HttpServletRequest request);  }
@Test public void testIsAjaxRequest() { request.addHeader("X-Requested-With", "XMLHttpRequest"); assertTrue(RequestUtils.isAjaxRequest(request)); }
@Test public void testNotAjaxRequest() { assertFalse(RequestUtils.isAjaxRequest(request)); }