@Test public void testSetStartDate_null() { Date startDate = cal.getStartDate(); cal.setStartDate(null); assertNotNull(cal.getStartDate()); assertSame(startDate, cal.getStartDate()); }
@Test public void testGetStartDate() { Date startDateBefore = new Date(); cal = new Calendar(calDocRef, isArchiv); Date startDateAfter = new Date(); assertTrue(startDateBefore.compareTo(cal.getStartDate()) <= 0); assertTrue(startDateAfter.compareTo(cal.getStartDate()) >= 0); }
@Test public void testSetStartDate() { Date startDate = cal.getStartDate(); Date newStartDate = new Date(); cal.setStartDate(newStartDate); assertNotNull(cal.getStartDate()); assertNotSame(startDate, cal.getStartDate()); assertSame(newStartDate, cal.getStartDate()); }
@Test public void testGetNrOfEvents_nonEmptyList() throws XWikiException { ArrayList<Long> eventList = new ArrayList<Long>(); eventList.add(123l); DocumentReference cal2DocRef = new DocumentReference(context.getDatabase(), "MyCalDoc2Space", "MyCal2Doc"); Calendar cal2 = new Calendar(cal2DocRef, isArchiv); cal2.setCalendarUtils(calUtils); cal2.inject_getEventCmd(eventMgrMock); expect(eventMgrMock.countEvents(eq(cal2DocRef), eq(isArchiv), eq(cal2.getStartDate()))) .andReturn(123l); replayAll(); long numEvents = cal2.getNrOfEvents(); verifyAll(); assertEquals("Expecting size of eventList.", 123l, numEvents); }