### Question:
MainServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { LiveConfiguration.updateConfiguration(); LiveConfiguration.setServer(req); resp.getOutputStream().println(ServletConstants.PAGE_HEADER); displayMetricsLink(req, resp.getOutputStream()); displayForm(req, resp.getOutputStream()); displayConfiguration(resp.getOutputStream()); resp.getOutputStream().close(); }  @Override void init(ServletConfig servletConfig);  }### Answer:
@Test public void whenServletPathIsSlash_showSimpleLinkToMetrics() throws Exception { request.setServletPath("/"); servlet.doGet(request, response); assertThat(response.getHtml(), containsString("href=\"metrics\"")); }
@Test public void whenServletPathIsEmpty_showFullLinkToMetrics() throws Exception { request.setServletPath(""); servlet.doGet(request, response); assertThat(response.getHtml(), containsString("href=\"/exporter/metrics\"")); }
@Test public void getRequest_containsConfigurationForm() throws Exception { request.setServletPath("/"); servlet.doGet(request, response); assertThat(response.getHtml(), containsString("form action=\"" + CONFIGURATION_PAGE + "\" method=\"post\" enctype=\"multipart/form-data\"")); }
@Test public void whenServletPathIsEmpty_showFullPathToConfigurationServlet() throws Exception { request.setServletPath(""); servlet.doGet(request, response); assertThat(response.getHtml(), containsString("action=\"/exporter/" + CONFIGURATION_PAGE + "\"")); }