### Question:
ContactsBackend extends ObmSyncBackend<WindowingContact> { @Override public BackendFolders getBackendFolders(UserDataRequest udr) { return new ContactBackendFoldersBuilder() .userDataRequest(udr) .defaultAddressBookName(contactConfiguration.getDefaultAddressBookName()) .folders(listAllAddressBooks()) .build(); } @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 currentFoldersShouldCallObmSync() throws Exception { Folder change = Folder.builder() .name("contacts") .uid(12) .ownerLoginAtDomain(user.getLoginAtDomain()).build(); Set<Folder> changes = ImmutableSet.of(change); Set<Folder> deletions = ImmutableSet.of(); FolderChanges folderChanges = new FolderChanges(changes, deletions, now); expect(bookClient.listAddressBooksChanged(token, epoch)).andReturn(folderChanges); mocks.replay(); BackendFolders currentFolders = contactsBackend.getBackendFolders(userDataRequest); mocks.verify(); assertThat(currentFolders).hasSize(1); assertThat(currentFolders.iterator().next()).isEqualTo( BackendFolder.builder() .backendId(AddressBookId.of(12)) .displayName("contacts") .folderType(FolderType.DEFAULT_CONTACTS_FOLDER) .parentId(Optional.<BackendId>absent()) .build()); }
@Test(expected=UnexpectedObmSyncServerException.class) public void currentFoldersShouldWrapServerFault() throws Exception { expect(bookClient.listAddressBooksChanged(token, epoch)).andThrow(new ServerFault("error")); mocks.replay(); try { contactsBackend.getBackendFolders(userDataRequest); } finally { mocks.verify(); } }
@Test(expected=IllegalStateException.class) public void currentFoldersShouldPropagateOtherException() throws Exception { expect(bookClient.listAddressBooksChanged(token, epoch)).andThrow(new IllegalStateException("error")); mocks.replay(); try { contactsBackend.getBackendFolders(userDataRequest); } finally { mocks.verify(); } }