public void testCalendar() throws IOException, SAXException
{
JSFSession jsfSession = JSFSessionFactory.makeSession("/richfaces/calendar.jsf");
JSFClientSession client = jsfSession.getJSFClientSession();
RichFacesClient ajaxClient = new RichFacesClient(client);
JSFServerSession server = jsfSession.getJSFServerSession();
client.click("pattern4"); // "MMM d, yyyy"
ajaxClient.setCalendarValue("myCalendar", "Oct 31, 2007");
client.click("german");
client.click("pattern4"); // "MMM d, yyyy"
Date date = (Date)server.getManagedBeanValue("#{calendarBean.selectedDate}");
String pattern = (String)server.getManagedBeanValue("#{calendarBean.pattern}");
Locale locale = (Locale)server.getManagedBeanValue("#{calendarBean.locale}");
assertEquals("DE", locale.getCountry());
SimpleDateFormat formatter = new SimpleDateFormat(pattern, locale);
String dateString = formatter.format(date);
assertEquals("Okt 31, 2007", dateString);
}