コード例 #1
0
 @Test
 public void testGetNrOfEvents_emptyList() {
   expect(eventMgrMock.countEvents(eq(calDocRef), eq(false), isA(Date.class))).andReturn(0L);
   replayAll();
   assertEquals("must be zero for empty list.", 0, cal.getNrOfEvents());
   verifyAll();
 }
コード例 #2
0
 @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);
 }