@SuppressWarnings("unchecked")
@Test
public void testResolveLocale() {

    Request request = createMock(Request.class);
    Map<String, Object> sessionScope = createMock(Map.class);
    Locale locale = Locale.ITALY;
    expect(request.getContext("session")).andReturn(sessionScope);
    expect(sessionScope.get(DefaultLocaleResolver.LOCALE_KEY)).andReturn(null);
    expect(request.getRequestLocale()).andReturn(locale);
    replay(request, sessionScope);
    DefaultLocaleResolver resolver = new DefaultLocaleResolver();
    assertSame(locale, resolver.resolveLocale(request));
    verify(request, sessionScope);
}