### Question:
ContactsBackend extends ObmSyncBackend<WindowingContact> { @Override public int getItemEstimateSize(UserDataRequest udr, ItemSyncState state, CollectionId collectionId, SyncCollectionOptions syncCollectionOptions) throws CollectionNotFoundException, DaoException, UnexpectedObmSyncServerException { WindowingChangesDelta<WindowingContact> allChanges = getAllChanges(udr, state, collectionId, syncCollectionOptions); return allChanges.getWindowingChanges().sumOfChanges(); } @Inject @VisibleForTesting  ContactsBackend(MappingService mappingService, 
			BookClient.Factory bookClientFactory, 
			ContactConfiguration contactConfiguration,
			WindowingDao windowingDao,
			ClientIdService clientIdService,
			ContactConverter contactConverter,
			DateService dateService,
			OpushResourcesHolder opushResourcesHolder,
			ContactCreationIdempotenceService creationIdempotenceService,
			FolderSnapshotDao folderSnapshotDao); @Override PIMDataType getPIMDataType(); @Override BackendFolders getBackendFolders(UserDataRequest udr); @Override int getItemEstimateSize(UserDataRequest udr, ItemSyncState state, CollectionId collectionId, 
		SyncCollectionOptions syncCollectionOptions); @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 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 messageId); @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 testGetItemEstimateSize() throws Exception { Date currentDate = DateUtils.getCurrentDate(); ItemSyncState lastKnownState = ItemSyncState.builder() .syncDate(currentDate) .syncKey(new SyncKey("1234567890a")) .build(); CollectionId collectionId = CollectionId.of(1); int bookId = 5; expect(folderSnapshotDao.get(user, device, collectionId)).andReturn( org.obm.push.bean.change.hierarchy.Folder.builder() .displayName("folder") .collectionId(collectionId) .backendId(AddressBookId.of(bookId)) .folderType(FolderType.DEFAULT_CONTACTS_FOLDER) .build()); int contactChangedUid = 215; Contact contactChanged = newContactObject(contactChangedUid); ContactChanges contactChanges = new ContactChanges(ImmutableList.<Contact> of(contactChanged), ImmutableSet.<Integer> of(), currentDate); expect(bookClient.listContactsChanged(token, currentDate, bookId)) .andReturn(contactChanges).once(); mocks.replay(); int itemEstimateSize = contactsBackend.getItemEstimateSize(userDataRequest, lastKnownState, collectionId, null); mocks.verify(); assertThat(itemEstimateSize).isEqualTo(1); }