@Test
 public void testLocaleSetting() throws Exception {
   view.init(minDate, maxDate, Locale.GERMAN);
   MonthView monthView = (MonthView) view.getAdapter().getView(1, null, null);
   CalendarRowView header = (CalendarRowView) monthView.grid.getChildAt(0);
   TextView firstDay = (TextView) header.getChildAt(0);
   assertThat(firstDay).hasTextString("Mo"); // Montag = Monday
   assertThat(monthView.title).hasTextString("Dezember 2012");
 }
 @Test
 public void testRightToLeftLocale() throws Exception {
   view.init(minDate, maxDate, new Locale("iw", "IL"));
   MonthView monthView = (MonthView) view.getAdapter().getView(1, null, null);
   CalendarRowView header = (CalendarRowView) monthView.grid.getChildAt(0);
   TextView firstDay = (TextView) header.getChildAt(0);
   assertThat(firstDay).hasTextString("ש"); // Last day of the week (Saturday) is the first cell.
   CalendarRowView firstWeek = (CalendarRowView) monthView.grid.getChildAt(1);
   TextView firstDate = (TextView) firstWeek.getChildAt(0);
   assertThat(firstDate).hasTextString("1");
   CalendarRowView secondWeek = (CalendarRowView) monthView.grid.getChildAt(2);
   TextView secondDate = (TextView) secondWeek.getChildAt(6);
   assertThat(secondDate).hasTextString("2");
   assertThat(monthView.title).hasTextString("דצמבר 2012");
 }
  @Test
  public void testSetShortWeekdays() throws Exception {
    String[] capitalDays = {"", "S", "M", "T", "W", "T", "F", "S"};

    Calendar cal = Calendar.getInstance(Locale.getDefault());
    assertThat(cal.getFirstDayOfWeek()).isEqualTo(Calendar.MONDAY);

    view.init(minDate, maxDate, Locale.getDefault()) //
        .setShortWeekdays(capitalDays);
    MonthView monthView = (MonthView) view.getAdapter().getView(1, null, null);
    CalendarRowView header = (CalendarRowView) monthView.grid.getChildAt(0);
    TextView firstDay = (TextView) header.getChildAt(0);
    assertThat(firstDay).hasTextString("M"); // Monday!
    TextView secondDay = (TextView) header.getChildAt(1);
    assertThat(secondDay).hasTextString("T"); // Tuesday!
    TextView thirdDay = (TextView) header.getChildAt(2);
    assertThat(thirdDay).hasTextString("W"); // Wednesday!
  }
  @Test
  public void testFirstDayOfWeekIsMonday() throws Exception {
    Locale greatBritain = new Locale("en", "GB");

    // Verify that firstDayOfWeek is actually Monday.
    Calendar cal = Calendar.getInstance(greatBritain);
    assertThat(cal.getFirstDayOfWeek()).isEqualTo(Calendar.MONDAY);

    view.init(minDate, maxDate, greatBritain);
    MonthView monthView = (MonthView) view.getAdapter().getView(1, null, null);
    CalendarRowView header = (CalendarRowView) monthView.grid.getChildAt(0);
    TextView firstDay = (TextView) header.getChildAt(0);
    assertThat(firstDay).hasTextString("Mon"); // Monday!

    List<List<MonthCellDescriptor>> cells = getCells(SEPTEMBER, 2013);
    assertThat(cells).hasSize(6);
    assertCell(cells, 0, 0, 26, false, false, false, false, NONE);
    assertCell(cells, 1, 0, 2, true, false, false, true, NONE);
    assertCell(cells, 5, 0, 30, true, false, false, true, NONE);
  }