@@ -0,0 +1,2915 @@
+package org.synyx.urlaubsverwaltung.calendar;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.Mock;%0Aimport org.mockito.junit.MockitoJUnitRunner;%0Aimport org.springframework.test.web.servlet.ResultActions;%0Aimport org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;%0A%0Aimport java.util.Optional;%0A%0Aimport static org.hamcrest.Matchers.hasProperty;%0Aimport static org.mockito.Mockito.verify;%0Aimport static org.mockito.Mockito.when;%0Aimport static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;%0Aimport static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;%0Aimport static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model;%0Aimport static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;%0Aimport static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;%0Aimport static org.springframework.test.web.servlet.setup.MockMvcBuilders.standaloneSetup;%0A%0A%0A@RunWith(MockitoJUnitRunner.class)%0Apublic class CalendarSharingViewControllerTest %7B%0A%0A    private CalendarSharingViewController sut;%0A%0A    @Mock%0A    private PersonCalendarService personCalendarService;%0A%0A    @Before%0A    public void setUp() %7B%0A        sut = new CalendarSharingViewController(personCalendarService);%0A    %7D%0A%0A    @Test%0A    public void index() throws Exception %7B%0A%0A        when(personCalendarService.getPersonCalendar(1)).thenReturn(Optional.of(new PersonCalendar()));%0A%0A        perform(get(%22/web/persons/1/calendar/share%22))%0A            .andExpect(view().name(%22calendarsharing/index%22))%0A            .andExpect(status().isOk());%0A    %7D%0A%0A    @Test%0A    public void indexNoPersonCalendar() throws Exception %7B%0A%0A        when(personCalendarService.getPersonCalendar(1)).thenReturn(Optional.empty());%0A%0A        perform(get(%22/web/persons/1/calendar/share%22))%0A            .andExpect(view().name(%22calendarsharing/index%22))%0A            .andExpect(model().attributeExists(%22privateCalendarShare%22))%0A            .andExpect(status().isOk());%0A    %7D%0A%0A    @Test%0A    public void linkPrivateCalendar() throws Exception %7B%0A%0A        perform(post(%22/web/persons/1/calendar/share/me%22))%0A            .andExpect(status().is3xxRedirection())%0A            .andExpect(view().name(%22redirect:/web/persons/1/calendar/share%22));%0A%0A        verify(personCalendarService).createCalendarForPerson(1);%0A    %7D%0A%0A    @Test%0A    public void unlinkPrivateCalendar() throws Exception %7B%0A%0A        perform(post(%22/web/persons/1/calendar/share/me%22).param(%22unlink%22, %22%22))%0A            .andExpect(status().is3xxRedirection())%0A            .andExpect(view().name(%22redirect:/web/persons/1/calendar/share%22));%0A%0A        verify(personCalendarService).deletePersonalCalendarForPerson(1);%0A    %7D%0A%0A    private ResultActions perform(MockHttpServletRequestBuilder builder) throws Exception %7B%0A        return standaloneSetup(sut).build().perform(builder);%0A    %7D%0A%7D%0A

Add test for overview share controller