package bak1an;


import com.google.api.services.calendar.Calendar;
import org.junit.Rule;
import org.junit.Test;
import org.junit.contrib.java.lang.system.StandardOutputStreamLog;

import java.io.IOException;

import static org.mockito.Mockito.*;


public class CalendarPrinterTest {
    @Rule
    public final StandardOutputStreamLog log = new StandardOutputStreamLog();

    @Test
    public void testCalendarPrinter() throws IOException {
        Calendar calendar = mock(Calendar.class, RETURNS_DEEP_STUBS);
        when(calendar.calendarList().list().execute().getItems()).thenReturn(null);

        CalendarPrinter printer = new CalendarPrinter(calendar);

        printer.printEvents();
    }
}

@@ -37,34 +37,127 @@
 api.
-services.calendar.Calendar
+client.util.DateTime;%0Aimport com.google.api.services.calendar.Calendar;%0Aimport com.google.api.services.calendar.model.*
 ;%0Aim
@@ -296,16 +296,116 @@
 eption;%0A
+import java.util.LinkedList;%0Aimport java.util.List;%0A%0Aimport static org.junit.Assert.assertNotEquals;
 %0Aimport 
@@ -649,241 +649,1578 @@
 ndar
- calendar = mock(Calendar.class, RETURNS_DEEP_STUBS);%0A        when(calendar.calendarList().list().execute().getItems()).thenReturn(null);%0A%0A        CalendarPrinter printer = new CalendarPrinter(calendar);%0A%0A        printer.printEvents(
+ListEntry calendar1 = new CalendarListEntry();%0A        calendar1.setId(%22ololo%22);%0A        List%3CCalendarListEntry%3E calendarListItems =  new LinkedList%3CCalendarListEntry%3E();%0A        calendarListItems.add(calendar1);%0A        CalendarList calendarList = new CalendarList();%0A        calendarList.setItems(calendarListItems);%0A%0A        Events events = new Events();%0A        List%3CEvent%3E eventsList = new LinkedList%3CEvent%3E();%0A        Event event1 = new Event();%0A        event1.setSummary(%22i'm event1%22);%0A        event1.setStart(new EventDateTime().setDateTime(new DateTime(System.currentTimeMillis())));%0A        event1.setEnd(new EventDateTime().setDateTime(new DateTime(System.currentTimeMillis() + 10000)));%0A        eventsList.add(event1);%0A        events.setItems(eventsList);%0A%0A        Calendar calendar = mock(Calendar.class, RETURNS_DEEP_STUBS);%0A        Calendar.CalendarList.List mockCalendarListRequest = mock(Calendar.CalendarList.List.class);%0A        Calendar.Events.List mockEventListRequest = mock(Calendar.Events.List.class);%0A%0A        when(mockCalendarListRequest.execute()).thenReturn(calendarList);%0A        when(mockEventListRequest.execute()).thenReturn(events);%0A        when(calendar.calendarList().list()).thenReturn(mockCalendarListRequest);%0A        when(calendar.events().list(anyString())).thenReturn(mockEventListRequest);%0A%0A        CalendarPrinter printer = new CalendarPrinter(calendar);%0A%0A        printer.printEvents();%0A%0A        assertNotEquals(log.getLog().indexOf(%22Calendar: ololo%22), -1);%0A        assertNotEquals(log.getLog().indexOf(%22title: i'm event1%22), -1
 );%0A 

fix test