コード例 #1
0
 /** @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()));
 }
コード例 #2
0
 /** @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")));
 }
コード例 #3
0
 /** @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")));
 }
コード例 #4
0
 /** @throws Exception */
 @Test
 public void initDefaultTimeZone() throws Exception {
   MockServletContext servletContext = new MockServletContext();
   FrontController frontController = new FrontController();
   servletContext.setInitParameter(ControllerConstants.TIME_ZONE_KEY, "PST");
   frontController.servletContext = servletContext;
   frontController.initDefaultTimeZone();
   assertThat(frontController.defaultTimeZone, is(TimeZone.getTimeZone("PST")));
 }