UnsupportedBrowserHandler extends SynchronizedRequestHandler { protected void writeBrowserTooOldPage(VaadinRequest request, VaadinResponse response) throws IOException { Writer page = response.getWriter(); WebBrowser browser = VaadinSession.getCurrent().getBrowser(); response.setContentType( ApplicationConstants.CONTENT_TYPE_TEXT_HTML_UTF_8); page.write( "<html>" + UNSUPPORTED_PAGE_HEAD_CONTENT + "<body><h1>I'm sorry, but your browser is not supported</h1>" + "<p>The version (" + browser.getBrowserMajorVersion() + "." + browser.getBrowserMinorVersion() + ") of the browser you are using " + " is outdated and not supported.</p>" + "<p>You should <b>consider upgrading</b> to a more up-to-date browser.</p> " + "<p>The most popular browsers are <b>" + " <a href=\"https: + " <a href=\"http: + (browser.isWindows() ? " <a href=\"https: : "") + " <a href=\"http: + " and <a href=\"http: + "Upgrading to the latest version of one of these <b>will make the web safer, faster and better looking.</b></p>" + "<p><sub><a onclick=\"document.cookie='" + FORCE_LOAD_COOKIE + "';window.location.reload();return false;\" href=\"#\">Continue without updating</a> (not recommended)</sub></p>" + "</body>\n" + "</html>"); page.close(); }  @Override boolean synchronizedHandleRequest(VaadinSession session,
            VaadinRequest request, VaadinResponse response); static final String FORCE_LOAD_COOKIE; static final String CLOSING_BRACKET; }
@Test public void writeBrowserTooOldPage_setContentType() throws IOException { initMocks(true, true); handler.writeBrowserTooOldPage(request, response); Mockito.verify(response).setContentType( ApplicationConstants.CONTENT_TYPE_TEXT_HTML_UTF_8); }