### Question:
CalendarBackend extends ObmSyncBackend<WindowingEvent> implements org.obm.push.ICalendarBackend { @Override public int getItemEstimateSize(UserDataRequest udr, ItemSyncState state, CollectionId collectionId, SyncCollectionOptions collectionOptions) throws CollectionNotFoundException, DaoException, UnexpectedObmSyncServerException, ConversionException, HierarchyChangedException { WindowingChangesDelta<WindowingEvent> allChanges = getAllChanges(udr, state, collectionId, collectionOptions); return allChanges.getWindowingChanges().sumOfChanges(); } @Inject @VisibleForTesting  CalendarBackend(MappingService mappingService, 
			CalendarClient.Factory calendarClientFactory, 
			EventConverter eventConverter, 
			EventService eventService,
			ConsistencyEventChangesLogger consistencyLogger,
			EventExtId.Factory eventExtIdFactory,
			WindowingDao windowingDao,
			ClientIdService clientIdService,
			Ical4jHelper ical4jHelper, 
			Ical4jUser.Factory ical4jUserFactory,
			DateService dateService,
			OpushResourcesHolder opushResourcesHolder,
			FolderSnapshotDao folderSnapshotDao); @Override PIMDataType getPIMDataType(); @Override BackendFolders getBackendFolders(final UserDataRequest udr); @Override int getItemEstimateSize(UserDataRequest udr, ItemSyncState state, CollectionId collectionId, SyncCollectionOptions collectionOptions); @Override ServerId createOrUpdate(UserDataRequest udr, CollectionId collectionId,
			ServerId serverId, String clientId, IApplicationData data); @Override void delete(UserDataRequest udr, CollectionId collectionId, ServerId serverId, Boolean moveToTrash); @Override ServerId handleMeetingResponse(UserDataRequest udr, Object iCalendar, AttendeeStatus status); @Override List<ItemChange> fetch(UserDataRequest udr, CollectionId collectionId, List<ServerId> fetchServerIds, SyncCollectionOptions syncCollectionOptions,
				ItemSyncState previousItemSyncState, SyncKey newSyncKey); @Override List<ItemChange> fetch(UserDataRequest udr, CollectionId collectionId, List<ServerId> fetchServerIds, SyncCollectionOptions syncCollectionOptions); @Override ServerId move(UserDataRequest udr, Folder srcFolder, Folder dstFolder,
			ServerId serverId); @Override void emptyFolderContent(UserDataRequest udr, Folder folder,
			boolean deleteSubFolder); @Override void initialize(DeviceId deviceId, CollectionId collectionId, FilterType filterType, SyncKey newSyncKey); @Override BackendId createFolder(UserDataRequest udr, FolderCreateRequest folderCreateRequest,
			Optional<BackendId> backendId);  }### Answer:
@Test public void testGetEstimateSize() throws Exception { Date currentDate = DateUtils.getCurrentDate(); ItemSyncState lastKnownKey = ItemSyncState.builder() .syncDate(currentDate) .syncKey(new SyncKey("1234567890a")) .build(); expect(folderSnapshotDao.get(user, device, collectionId)).andReturn(calendarFolder); EventChanges eventChanges = expectTwoDeletedAndTwoUpdatedEventChanges(currentDate, 11, 12, 21, 22); expect(calendarClient.getSync(token, "test", currentDate)) .andReturn(eventChanges).once(); expect(calendarClient.getUserEmail(token)) .andReturn("test").anyTimes(); expectConvertUpdatedEventsToMSEvents(eventChanges); mockControl.replay(); BodyPreference.Builder bodyPreferenceBuilder = BodyPreference.builder(); BodyPreference bodyPreference = bodyPreferenceBuilder.build(); SyncCollectionOptions syncCollectionOptions = SyncCollectionOptions.builder() .filterType(FilterType.ALL_ITEMS) .bodyPreferences(ImmutableList.of(bodyPreference)) .build(); int itemEstimateSize = calendarBackend.getItemEstimateSize(userDataRequest, lastKnownKey, collectionId, syncCollectionOptions); mockControl.verify(); assertThat(itemEstimateSize).isEqualTo(4); }