/** @throws Exception */ @Test public void processTimeZoneForNoSetting() throws Exception { MockServletContext servletContext = new MockServletContext(); MockHttpServletRequest request = new MockHttpServletRequest(servletContext); FrontController frontController = new FrontController(); assertThat(frontController.processTimeZone(request), is(TimeZone.getDefault())); }
/** @throws Exception */ @Test public void processTimeZoneForDefaultLocale() throws Exception { MockServletContext servletContext = new MockServletContext(); MockHttpServletRequest request = new MockHttpServletRequest(servletContext); FrontController frontController = new FrontController(); frontController.defaultTimeZone = TimeZone.getTimeZone("PST"); assertThat(frontController.processTimeZone(request), is(TimeZone.getTimeZone("PST"))); }
/** @throws Exception */ @Test public void processTimeZoneForSession() throws Exception { MockServletContext servletContext = new MockServletContext(); MockHttpServletRequest request = new MockHttpServletRequest(servletContext); request.getSession().setAttribute(ControllerConstants.TIME_ZONE_KEY, "PST"); FrontController frontController = new FrontController(); frontController.defaultTimeZone = TimeZone.getTimeZone("JST"); assertThat(frontController.processTimeZone(request), is(TimeZone.getTimeZone("PST"))); }