### Question:
MSEventToObmEventConverterImpl implements MSEventToObmEventConverter { @VisibleForTesting boolean isOrganizerEmail(String email, Event eventFromDB) { if (email == null || eventFromDB == null) { return false; } Attendee organizer = eventFromDB.findOrganizer(); if (organizer != null && email.equals(organizer.getEmail())) { return true; } return false; }  @Override Event convert(User user, Event eventFromDB, MSEvent msEvent, boolean isObmInternalEvent); ParticipationRole getParticipationRole(AttendeeType attendeeType); @Override Participation getParticipation(Participation oldParticipation, AttendeeStatus attendeeStatus); @Override Participation getParticipation(AttendeeStatus status); @Override boolean isInternalEvent(Event event, boolean defaultValue); static final Map<CalendarSensitivity, EventPrivacy> SENSITIVITY_TO_PRIVACY; }### Answer:
@Test public void testIsOrganizerEmailNullEmail() { MSEventToObmEventConverterImpl msEventToObmEventConverterImpl = new MSEventToObmEventConverterImpl(); boolean organizerEmail = msEventToObmEventConverterImpl.isOrganizerEmail(null, fakeEvent(null)); assertThat(organizerEmail).isFalse(); }
@Test public void testIsOrganizerEmailNullEvent() { MSEventToObmEventConverterImpl msEventToObmEventConverterImpl = new MSEventToObmEventConverterImpl(); boolean organizerEmail = msEventToObmEventConverterImpl.isOrganizerEmail("user@opush.org", null); assertThat(organizerEmail).isFalse(); }
@Test public void testIsOrganizerEmailWithoutAttendees() { String email = "user@opush.org"; MSEventToObmEventConverterImpl msEventToObmEventConverterImpl = new MSEventToObmEventConverterImpl(); boolean organizerEmail = msEventToObmEventConverterImpl.isOrganizerEmail(email, fakeEvent(ImmutableList.<Attendee> of())); assertThat(organizerEmail).isFalse(); }
@Test public void testIsOrganizerEmailWithAttendee() { String email = "user@opush.org"; MSEventToObmEventConverterImpl msEventToObmEventConverterImpl = new MSEventToObmEventConverterImpl(); boolean organizerEmail = msEventToObmEventConverterImpl.isOrganizerEmail(email, fakeEvent(ImmutableList.of(fakeAttendee(email, true)))); assertThat(organizerEmail).isTrue(); }
@Test public void testIsOrganizerEmailWithAttendees() { String email = "user@opush.org"; MSEventToObmEventConverterImpl msEventToObmEventConverterImpl = new MSEventToObmEventConverterImpl(); boolean organizerEmail = msEventToObmEventConverterImpl.isOrganizerEmail(email, fakeEvent(ImmutableList.of(fakeAttendee("no1@opush.org", false), fakeAttendee("no2@opush.org", false), fakeAttendee(email, true), fakeAttendee("no3@opush.org", false)))); assertThat(organizerEmail).isTrue(); }
@Test public void testIsOrganizerEmailWithoutCorrespondingAttendee() { String email = "user@opush.org"; MSEventToObmEventConverterImpl msEventToObmEventConverterImpl = new MSEventToObmEventConverterImpl(); boolean organizerEmail = msEventToObmEventConverterImpl.isOrganizerEmail(email, fakeEvent(ImmutableList.of(fakeAttendee("no1@opush.org", false), fakeAttendee("no2@opush.org", false), fakeAttendee("no3@opush.org", false)))); assertThat(organizerEmail).isFalse(); }