@Test public void testTimeZone() { String value = "- " + TIMEZONE_CUSTOM.getID(); Cookie cookie = new Cookie(DEFAULT_COOKIE_NAME, value); when(request.getCookies()).thenReturn(new Cookie[]{cookie}); LocaleContext context = resolver.resolveLocaleContext(request); assertThat(context).isNotNull(); assertThat(context).isInstanceOf(TimeZoneAwareLocaleContext.class); Locale locale = ((TimeZoneAwareLocaleContext) context).getLocale(); TimeZone zone = ((TimeZoneAwareLocaleContext) context).getTimeZone(); assertThat(locale).isEqualTo(LOCALE_DEFAULT); assertThat(zone).isEqualTo(TIMEZONE_CUSTOM); List<Event> events = recorder.play(); assertThat(events).isEmpty(); }
@Override public LocaleContext resolveLocaleContext(final HttpServletRequest request) { parseAngularCookieIfNecessary(request); return new TimeZoneAwareLocaleContext() { @Override public Locale getLocale() { return (Locale) request.getAttribute(LOCALE_REQUEST_ATTRIBUTE_NAME); } @Override public TimeZone getTimeZone() { return (TimeZone) request.getAttribute(TIME_ZONE_REQUEST_ATTRIBUTE_NAME); } }; }
AngularCookieLocaleResolver extends CookieLocaleResolver { @Override public LocaleContext resolveLocaleContext(final HttpServletRequest request) { parseAngularCookieIfNecessary(request); return new TimeZoneAwareLocaleContext() { @Override public Locale getLocale() { return (Locale) request.getAttribute(LOCALE_REQUEST_ATTRIBUTE_NAME); } @Override public TimeZone getTimeZone() { return (TimeZone) request.getAttribute(TIME_ZONE_REQUEST_ATTRIBUTE_NAME); } }; } }
AngularCookieLocaleResolver extends CookieLocaleResolver { @Override public LocaleContext resolveLocaleContext(final HttpServletRequest request) { parseAngularCookieIfNecessary(request); return new TimeZoneAwareLocaleContext() { @Override public Locale getLocale() { return (Locale) request.getAttribute(LOCALE_REQUEST_ATTRIBUTE_NAME); } @Override public TimeZone getTimeZone() { return (TimeZone) request.getAttribute(TIME_ZONE_REQUEST_ATTRIBUTE_NAME); } }; }  }
AngularCookieLocaleResolver extends CookieLocaleResolver { @Override public LocaleContext resolveLocaleContext(final HttpServletRequest request) { parseAngularCookieIfNecessary(request); return new TimeZoneAwareLocaleContext() { @Override public Locale getLocale() { return (Locale) request.getAttribute(LOCALE_REQUEST_ATTRIBUTE_NAME); } @Override public TimeZone getTimeZone() { return (TimeZone) request.getAttribute(TIME_ZONE_REQUEST_ATTRIBUTE_NAME); } }; }  @Override Locale resolveLocale(HttpServletRequest request); @Override LocaleContext resolveLocaleContext(final HttpServletRequest request); @Override void addCookie(HttpServletResponse response, String cookieValue); }
AngularCookieLocaleResolver extends CookieLocaleResolver { @Override public LocaleContext resolveLocaleContext(final HttpServletRequest request) { parseAngularCookieIfNecessary(request); return new TimeZoneAwareLocaleContext() { @Override public Locale getLocale() { return (Locale) request.getAttribute(LOCALE_REQUEST_ATTRIBUTE_NAME); } @Override public TimeZone getTimeZone() { return (TimeZone) request.getAttribute(TIME_ZONE_REQUEST_ATTRIBUTE_NAME); } }; }  @Override Locale resolveLocale(HttpServletRequest request); @Override LocaleContext resolveLocaleContext(final HttpServletRequest request); @Override void addCookie(HttpServletResponse response, String cookieValue); static final String QUOTE; }