### Question:
CaptchaBehavior implements Behavior { @Override public void act(final HttpServletRequest request, final HttpServletResponse response) throws IOException { final HttpSession session = request.getSession(); session.setAttribute(CAPTCHA_CHALLENGE_SESSION_ATTR, true); }  @Override void act(final HttpServletRequest request, final HttpServletResponse response); @Override boolean isCommitting(); @Override String name(); @Override String toString(); static final String CAPTCHA_CHALLENGE_SESSION_ATTR; }### Answer:
@Test void should_set_flag_to_display_captcha_if_session_present() throws IOException { MockHttpServletRequest request = new MockHttpServletRequest(); final MockHttpSession session = new MockHttpSession(); request.setSession(session); act(request); assertEquals(true, session.getAttribute(CAPTCHA_CHALLENGE_SESSION_ATTR)); }