### Question:
ContactsBackend extends ObmSyncBackend<WindowingContact> { @Override public void delete(UserDataRequest udr, CollectionId collectionId, ServerId serverId, Boolean moveToTrash) throws CollectionNotFoundException, DaoException, UnexpectedObmSyncServerException, ItemNotFoundException { Integer contactId = serverId.getItemId(); Folder folder = folderSnapshotDao.get(udr.getUser(), udr.getDevice(), collectionId); AddressBookId addressBookId = folder.getTypedBackendId(); try { removeContact(addressBookId, contactId); } catch (NoPermissionException e) { logger.warn(e.getMessage()); } catch (ContactNotFoundException e) { logger.warn(e.getMessage()); } finally { creationIdempotenceService.remove(udr, collectionId, serverId); } } @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 testDelete() throws Exception { CollectionId collectionId = CollectionId.of(1); int bookId = 5; ServerId serverId = collectionId.serverId(215); 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()); expect(bookClient.removeContact(token, bookId, serverId.getItemId())) .andReturn(newContactObject(serverId.getItemId())).once(); creationIdempotenceService.remove(userDataRequest, collectionId, serverId); expectLastCall(); mocks.replay(); contactsBackend.delete(userDataRequest, collectionId, serverId, true); mocks.verify(); }