BlockLocalhostUsageStatusServlet extends HttpServlet { @Override protected void doPost(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { doGet(req, resp); } @Autowired  BlockLocalhostUsageStatusServlet(LocalhostRequestProcessorToggle localhostRequestProcessorToggle);   }
@Test public void doPostShouldCallDoGet() throws ServletException, IOException { given(resp.getWriter()).willReturn(printWriter); given(localhostRequestProcessorToggle.isOn()).willReturn(true); underTest.doPost(req, resp); verify(resp).setContentType("application/json"); verify(localhostRequestProcessorToggle).isOn(); verify(printWriter).write("{\"localhostMode\":true}"); }