@Test
  public void testItDrawsDaysOnCalender() {
    // simulate Feb month
    underTest.setGrowProgress(
        1000); // set grow progress so that it simulates the calendar being open
    when(calendar.get(Calendar.DAY_OF_WEEK)).thenReturn(1);
    when(calendar.get(Calendar.MONTH)).thenReturn(1);
    when(calendar.getActualMaximum(Calendar.DAY_OF_MONTH)).thenReturn(28);

    underTest.drawMonth(canvas, calendar, 0);

    for (int dayColumn = 0, dayRow = 0; dayColumn <= 6; dayRow++) {
      if (dayRow == 7) {
        dayRow = 0;
        if (dayColumn <= 6) {
          dayColumn++;
        }
      }
      if (dayColumn == dayColumnNames.length) {
        break;
      }
      if (dayColumn == 0) {
        verify(canvas).drawText(eq(dayColumnNames[dayColumn]), anyInt(), anyInt(), eq(paint));
      } else {
        int day = ((dayRow - 1) * 7 + dayColumn + 1) - 6;
        if (day > 0 && day <= 28) {
          verify(canvas).drawText(eq(String.valueOf(day)), anyInt(), anyInt(), eq(paint));
        }
      }
    }
  }
  @Test
  public void testItAbbreviatesDayNames() {
    // simulate Feb month
    when(calendar.get(Calendar.DAY_OF_WEEK)).thenReturn(1);
    when(calendar.get(Calendar.MONTH)).thenReturn(1);
    when(calendar.getActualMaximum(Calendar.DAY_OF_MONTH)).thenReturn(28);

    underTest.setGrowProgress(
        1000); // set grow progress so that it simulates the calendar being open
    underTest.setLocale(Locale.FRANCE);
    reset(canvas); // reset because invalidate is called
    underTest.setUseWeekDayAbbreviation(true);
    reset(canvas); // reset because invalidate is called
    underTest.drawMonth(canvas, calendar, 0);

    DateFormatSymbols dateFormatSymbols = new DateFormatSymbols(Locale.FRANCE);
    String[] dayNames = dateFormatSymbols.getShortWeekdays();

    InOrder inOrder = inOrder(canvas);
    inOrder.verify(canvas).drawText(eq(dayNames[2]), anyInt(), anyInt(), eq(paint));
    inOrder.verify(canvas).drawText(eq(dayNames[3]), anyInt(), anyInt(), eq(paint));
    inOrder.verify(canvas).drawText(eq(dayNames[4]), anyInt(), anyInt(), eq(paint));
    inOrder.verify(canvas).drawText(eq(dayNames[5]), anyInt(), anyInt(), eq(paint));
    inOrder.verify(canvas).drawText(eq(dayNames[6]), anyInt(), anyInt(), eq(paint));
    inOrder.verify(canvas).drawText(eq(dayNames[7]), anyInt(), anyInt(), eq(paint));
    inOrder.verify(canvas).drawText(eq(dayNames[1]), anyInt(), anyInt(), eq(paint));
  }
  @Test
  public void testItDrawsMultipleEventDaysOnCalendar() {
    // Sun, 07 Jun 2015 18:20:51 GMT
    // get 60 events in total
    List<Events> events = getDayEventWith2EventsPerDay(0, 30, 1433701251000L);
    when(eventsContainer.getEventsForMonthAndYear(5, 2015)).thenReturn(events);
    when(calendar.get(Calendar.MONTH)).thenReturn(5);
    when(calendar.get(Calendar.YEAR)).thenReturn(2015);

    underTest.setGrowProgress(
        1000); // set grow progress so that it simulates the calendar being open
    underTest.drawEvents(canvas, calendar, 0);

    // draw events 58 times because we don't draw events for the current selected day since it wil
    // be highlighted with another indicator
    verify(canvas, times(58)).drawCircle(anyFloat(), anyFloat(), anyFloat(), eq(paint));
  }
  @Test
  public void testItDrawsMultipleEventDaysOnCalendarWithPlusIndicator() {
    // Sun, 07 Jun 2015 18:20:51 GMT
    // get 120 events in total but only draw 3 event indicators per a day
    List<Events> events = getDayEventWithMultipleEventsPerDay(0, 30, 1433701251000L);
    when(eventsContainer.getEventsForMonthAndYear(5, 2015)).thenReturn(events);
    when(calendar.get(Calendar.MONTH)).thenReturn(5);
    when(calendar.get(Calendar.YEAR)).thenReturn(2015);

    underTest.setGrowProgress(
        1000); // set grow progress so that it simulates the calendar being open
    underTest.drawEvents(canvas, calendar, 0);

    // draw events 58 times because we don't draw more than 3 indicators
    verify(canvas, times(58)).drawCircle(anyFloat(), anyFloat(), anyFloat(), eq(paint));

    // draw event indicator with lines
    // 2 calls for each plus event indicator since it takes 2 draw calls to make a plus sign
    verify(canvas, times(58)).drawLine(anyFloat(), anyFloat(), anyFloat(), anyFloat(), eq(paint));
  }
  @Test
  public void testItDrawsFirstLetterOfEachDay() {
    // simulate Feb month
    when(calendar.get(Calendar.DAY_OF_WEEK)).thenReturn(1);
    when(calendar.get(Calendar.MONTH)).thenReturn(1);
    when(calendar.getActualMaximum(Calendar.DAY_OF_MONTH)).thenReturn(28);

    underTest.setGrowProgress(
        1000); // set grow progress so that it simulates the calendar being open
    underTest.drawMonth(canvas, calendar, 0);

    InOrder inOrder = inOrder(canvas);
    inOrder.verify(canvas).drawText(eq("M"), anyInt(), anyInt(), eq(paint));
    inOrder.verify(canvas).drawText(eq("T"), anyInt(), anyInt(), eq(paint));
    inOrder.verify(canvas).drawText(eq("W"), anyInt(), anyInt(), eq(paint));
    inOrder.verify(canvas).drawText(eq("T"), anyInt(), anyInt(), eq(paint));
    inOrder.verify(canvas).drawText(eq("F"), anyInt(), anyInt(), eq(paint));
    inOrder.verify(canvas).drawText(eq("S"), anyInt(), anyInt(), eq(paint));
    inOrder.verify(canvas).drawText(eq("S"), anyInt(), anyInt(), eq(paint));
  }
  @Test
  public void testItDrawsSundayAsFirstDay() {
    // simulate Feb month
    when(calendar.get(Calendar.DAY_OF_WEEK)).thenReturn(1);
    when(calendar.get(Calendar.MONTH)).thenReturn(1);
    when(calendar.getActualMaximum(Calendar.DAY_OF_MONTH)).thenReturn(28);

    underTest.setGrowProgress(
        1000); // set grow progress so that it simulates the calendar being open
    underTest.setShouldShowMondayAsFirstDay(false);
    underTest.setUseWeekDayAbbreviation(true);
    underTest.drawMonth(canvas, calendar, 0);

    InOrder inOrder = inOrder(canvas);
    inOrder.verify(canvas).drawText(eq("Sun"), anyInt(), anyInt(), eq(paint));
    inOrder.verify(canvas).drawText(eq("Mon"), anyInt(), anyInt(), eq(paint));
    inOrder.verify(canvas).drawText(eq("Tue"), anyInt(), anyInt(), eq(paint));
    inOrder.verify(canvas).drawText(eq("Wed"), anyInt(), anyInt(), eq(paint));
    inOrder.verify(canvas).drawText(eq("Thu"), anyInt(), anyInt(), eq(paint));
    inOrder.verify(canvas).drawText(eq("Fri"), anyInt(), anyInt(), eq(paint));
    inOrder.verify(canvas).drawText(eq("Sat"), anyInt(), anyInt(), eq(paint));
  }
  @Test
  public void testItSetsDayColumns() {
    // simulate Feb month
    when(calendar.get(Calendar.DAY_OF_WEEK)).thenReturn(1);
    when(calendar.get(Calendar.MONTH)).thenReturn(1);
    when(calendar.getActualMaximum(Calendar.DAY_OF_MONTH)).thenReturn(28);

    String[] dayNames = {"Mon", "Tue", "Wed", "Thur", "Fri", "Sat", "Sun"};
    underTest.setGrowProgress(
        1000); // set grow progress so that it simulates the calendar being open
    underTest.setDayColumnNames(dayNames);
    underTest.drawMonth(canvas, calendar, 0);

    InOrder inOrder = inOrder(canvas);
    inOrder.verify(canvas).drawText(eq("Mon"), anyInt(), anyInt(), eq(paint));
    inOrder.verify(canvas).drawText(eq("Tue"), anyInt(), anyInt(), eq(paint));
    inOrder.verify(canvas).drawText(eq("Wed"), anyInt(), anyInt(), eq(paint));
    inOrder.verify(canvas).drawText(eq("Thur"), anyInt(), anyInt(), eq(paint));
    inOrder.verify(canvas).drawText(eq("Fri"), anyInt(), anyInt(), eq(paint));
    inOrder.verify(canvas).drawText(eq("Sat"), anyInt(), anyInt(), eq(paint));
    inOrder.verify(canvas).drawText(eq("Sun"), anyInt(), anyInt(), eq(paint));
  }