### Question:
ICalendarConverter { public MSMeetingRequest convertToMSMeetingRequest(ICalendar icalendar) { Preconditions.checkNotNull(icalendar, "ICalendar is null"); Builder builder = MSMeetingRequest.builder(); if (icalendar.hasEvent()) { ICalendarEvent iCalendarEvent = icalendar.getICalendarEvent(); ICalendarMethod method = icalendar.getICalendarMethod(); TimeZone timeZone = getTimeZone(icalendar.getICalendarTimeZone()); fillMsMeetingRequestFromVEvent(iCalendarEvent, method, builder); if (iCalendarEvent.hasRecur()) { ICalendarRecur iCalendarRule = iCalendarEvent.recur(); builder.recurrenceId(recurrenceId(iCalendarEvent)); builder.instanceType(MSMeetingRequestInstanceType.MASTER_RECURRING); fillMsMeetingRequestFromRRule(iCalendarRule, iCalendarEvent, timeZone, builder); } else if (iCalendarEvent.recurrenceId() != null) { return null; } builder.timeZone(timeZone); return builder.build(); } return null; }  MSMeetingRequest convertToMSMeetingRequest(ICalendar icalendar);  }### Answer:
@Test public void testICalendarConverterAllowNoDTSTAMP() throws IOException, ParserException { ICalendar icalendar = icalendar("noDTSTAMP.ics"); MSMeetingRequest msMeetingRequest = icalendarConverter.convertToMSMeetingRequest(icalendar); assertThat(msMeetingRequest.getDtStamp()).isEqualTo(new DateTime("1970-01-01T00:00:00Z").toDate()); }
@Test(expected=IllegalArgumentException.class) public void testICalendarConverterSingleEventBadOrganizerFormat() throws IOException, ParserException { ICalendar icalendar = icalendar("single_event_organizer-bad-format.zimbra.ics"); icalendarConverter.convertToMSMeetingRequest(icalendar); }
@Test public void testICalendarConverterOrphanedEventException() throws IOException, ParserException { ICalendar icalendar = icalendar("orphaned_event_exception.ics"); MSMeetingRequest msMeetingRequest = icalendarConverter.convertToMSMeetingRequest(icalendar); assertThat(msMeetingRequest).isNull(); }
@Test public void testICalendarConverterYearlyWithoutBYMONTHGetTheStartDateOne() throws IOException, ParserException { ICalendar icalendar = icalendar("recur_event_freq-yearly_bymonth_unset.ics"); MSMeetingRequest msMeetingRequest = icalendarConverter.convertToMSMeetingRequest(icalendar); int julyMonthIndex = 7; MSMeetingRequestRecurrence recurrence = Iterables.getOnlyElement(msMeetingRequest.getRecurrences()); assertThat(recurrence.getMonthOfYear()).isEqualTo(julyMonthIndex); }