### Question:
SessionSetupListener implements HttpSessionListener { @Override public void sessionCreated(HttpSessionEvent se) { try { if (sessionTimeoutProperty == null) { synchronized (this) { if (sessionTimeoutProperty == null){ ServletContext context = se.getSession().getServletContext(); sessionTimeoutProperty = getBeanFormApplicationContext(context, JCommuneProperty.class, "sessionTimeoutProperty"); locationService = getBeanFormApplicationContext(context, LocationService.class); int seconds = extractValueFromProperty(sessionTimeoutProperty); TIME_OUT_SECONDS = seconds > 0 ? seconds : -1; } } } se.getSession().setMaxInactiveInterval(TIME_OUT_SECONDS); } catch (Exception ex) { logger.warn("Bean instantiation error: " + ex); throw ex; } }  @Override void sessionCreated(HttpSessionEvent se); @Override void sessionDestroyed(HttpSessionEvent se); static void resetSessionTimeoutProperty();  }### Answer:
@Test public void testSessionTimeoutSet() throws Exception { Property oneHourTimeout = new Property(PROPERTY_NAME, String.valueOf(1)); when(propertyDao.getByName(PROPERTY_NAME)).thenReturn(oneHourTimeout); listener.sessionCreated(event); int expireTime = (int) TimeUnit.SECONDS.convert(sessionTimeoutProperty.intValue(), TimeUnit.MINUTES); assertEquals(session.getMaxInactiveInterval(), expireTime); }
@Test public void testSessionZeroTimeoutConversion() throws Exception { Property oneHourTimeout = new Property(PROPERTY_NAME, String.valueOf(0)); when(propertyDao.getByName(PROPERTY_NAME)).thenReturn(oneHourTimeout); listener.sessionCreated(event); assertEquals(session.getMaxInactiveInterval(), -1); }