### Question:
CitationManager implements ICitationManager { @Override public ICitation updateCitationFromZotero(IUser user, String groupId, String itemKey) throws GroupDoesNotExistException, CannotFindCitationException, ZoteroHttpStatusException { Optional<ICitationGroup> groupOptional = groupRepository.findByGroupId(new Long(groupId)); if (!groupOptional.isPresent()) { throw new GroupDoesNotExistException("Group with id " + groupId + " does not exist."); } try { ICitation citation = zoteroManager.getGroupItem(user, groupId, itemKey); citation.setGroup(groupOptional.get().getGroupId() + ""); Optional<ICitation> oldCitation = citationRepository.findByKey(itemKey); if(oldCitation.isPresent()) { citationRepository.delete((Citation)oldCitation.get()); } citationRepository.save((Citation) citation); return citation; } catch (HttpClientErrorException ex) { throw new CannotFindCitationException(ex); } }  @PostConstruct void init(); @Override ICitation getCitation(IUser user, String groupId, String key); @Override ICitation getCitationFromZotero(IUser user, String groupId, String key); @Override void updateCitation(IUser user, String groupId, ICitation citation); @Override ICitation createCitation(IUser user, String groupId, List<String> collectionIds, ICitation citation); @Override ICitation updateCitationFromZotero(IUser user, String groupId, String itemKey); @Override List<ICitationGroup> getGroups(IUser user); @Override @SuppressWarnings("unchecked") CloseableIterator<ICitation> getAllGroupItems(IUser user, String groupId, String collectionId); @Override CitationResults getGroupItems(IUser user, String groupId, String collectionId, int page, String sortBy); @Override void forceGroupItemsRefresh(IUser user, String groupId, String collectionId, int page, String sortBy); @Override List<BibField> getItemTypeFields(IUser user, ItemType itemType); @Override List<String> getValidCreatorTypes(IUser user, ItemType itemType); @Override CitationPage getPrevAndNextCitation(IUser user, String groupId, String collectionId, int page, String sortBy,
            int index);  }### Answer:
@Test public void test_updateCitationFromZotero_success() throws GroupDoesNotExistException, CannotFindCitationException, ZoteroHttpStatusException { ICitation updatedCitation = new Citation(); updatedCitation.setKey(EXISTING_ID); updatedCitation.setVersion(new Long(2)); Mockito.when(zoteroManager.getGroupItem(user, GROUP_ID, EXISTING_ID)).thenReturn(updatedCitation); ICitation actual = managerToTest.updateCitationFromZotero(user, GROUP_ID, EXISTING_ID); Mockito.verify(citationRepository).save((Citation)updatedCitation); Assert.assertEquals(updatedCitation, actual); }