BlockLocalhostUsageOffServlet extends HttpServlet { @Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { logger.info(urlAccessLogMessageAssembler.assembleMessage(req, "Set Localhost Mode: OFF")); localhostRequestProcessorToggle.switchOff(); } @Autowired  BlockLocalhostUsageOffServlet(LocalhostRequestProcessorToggle localhostRequestProcessorToggle,
            UrlAccessLogMessageAssembler urlAccessLogMessageAssembler);   }
@Test public void doGetShouldLogMessageAtInfoLevel() throws ServletException, IOException { Whitebox.setInternalState(underTest, "logger", logger); underTest.doGet(req, resp); verify(logger).info(Mockito.anyString()); }
@Test public void doGetShouldSwitchLocalhostRequestProcessingOff() throws ServletException, IOException { underTest.doGet(req, resp); verify(localhostRequestProcessorToggle).switchOff(); }