### Question:
ICalParser { public static ICalData parse(ICalPart part) { String iCalText = MessageExtractor.getTextFromPart(part.getPart()); if (iCalText == null) { return new ICalData(new ArrayList<ICalendar>()); } return new ICalData(Biweekly.parse(iCalText).all()); }  static ICalData parse(ICalPart part); static final String MIME_TYPE; }### Answer:
@Test public void parse_withNoText_returnsDataWithNoEvents() throws MessagingException { ICalPart part = new ICalPart(null); ICalData data = ICalParser.parse(part); assertEquals(0, data.getCalendarData().size()); }
@Test public void parse_returnsCorrectDataForMinimalPublishEvent() throws MessagingException { String calendar = "BEGIN:VCALENDAR\r\n" + "METHOD:PUBLISH\r\n" + "PRODID:-"VERSION:2.0\r\n" + "BEGIN:VEVENT\r\n" + "ORGANIZER:mailto:a@example.com\r\n" + "DTSTART:19970701T200000Z\r\n" + "DTSTAMP:19970611T190000Z\r\n" + "SUMMARY:ST. PAUL SAINTS -VS- DULUTH-SUPERIOR DUKES\r\n" + "UID:0981234-1234234-23@example.com\r\n" + "END:VEVENT\r\n" + "END:VCALENDAR"; Body body = new TextBody(calendar); MimeBodyPart dataPart = new MimeBodyPart(body); ICalPart part = new ICalPart(dataPart); ICalData data = ICalParser.parse(part); assertEquals(1, data.getCalendarData().size()); assertEquals("PUBLISH", data.getCalendarData().get(0).getMethod().getValue()); assertEquals("a@example.com", data.getCalendarData().get(0).getOrganizer().getEmail()); }