### Question:
ItemVersionManagerImpl implements ItemVersionManager { @Override public void resetRevision(SessionContext context, Id itemId, Id versionId, Id revisionId) { validateItemVersionExistence(context, Space.PRIVATE, itemId, versionId); Response<CoreMergeChange> response = getCollaborationAdaptor(context) .resetItemVersionRevision(context, itemId, versionId, revisionId); ValidationUtil.validateResponse(response, logger, ErrorCode.ZU_ITEM_VERSION_RESET_REVISION); saveMergeChange(context, Space.PRIVATE, itemId, versionId, response.getValue()); }  @Override Collection<ItemVersion> list(SessionContext context, Space space, Id itemId); @Override boolean isExist(SessionContext context, Space space, Id itemId, Id versionId); @Override ItemVersion get(SessionContext context, Space space, Id itemId, Id versionId,
                         Id revisionId); @Override Id create(SessionContext context, Id itemId, Id baseVersionId,
                   ItemVersionData data); @Override Id create(SessionContext context, Id itemId, Id versionId, Id baseVersionId, ItemVersionData data); @Override void update(SessionContext context, Id itemId, Id versionId, ItemVersionData data); @Override void delete(SessionContext context, Id itemId, Id versionId); @Override ItemVersionStatus getStatus(SessionContext context, Id itemId, Id versionId); @Override void tag(SessionContext context, Id itemId, Id versionId, Id changeId, Tag tag); @Override void publish(SessionContext context, Id itemId, Id versionId, String message); @Override CoreMergeResult sync(SessionContext context, Id itemId, Id versionId); @Override CoreMergeResult forceSync(SessionContext context, Id itemId, Id versionId); @Override CoreMergeResult merge(SessionContext context, Id itemId, Id versionId,
                               Id sourceVersionId); @Override ItemVersionRevisions listRevisions(SessionContext context, Id itemId, Id versionId); @Override Revision getRevision(SessionContext context, Id itemId, Id versionId, Id revisionId); @Override void resetRevision(SessionContext context, Id itemId,
                            Id versionId, Id revisionId); @Override void revertRevision(SessionContext context, Id itemId,
                             Id versionId, Id revisionId); @Override void updateModificationTime(SessionContext context, Space space, Id itemId,
                                     Id versionId, Date modificationTime); @Override CoreItemVersionConflict getConflict(SessionContext context, Id itemId,
                                             Id versionId); @Override void saveMergeChange(SessionContext context, Space space, Id itemId,
                              ItemVersionChange itemVersionChange);  }### Answer:
@Test public void testResetRevision() { Id itemId = new Id(); Id versionId = new Id(); mockExistingVersion(Space.PRIVATE, itemId, versionId); Id changeRef = new Id("changeRef"); CoreMergeChange mergeChange = createMergeChange(versionId, false); doReturn(new Response<>(mergeChange)) .when(collaborationAdaptorMock) .resetItemVersionRevision(context, itemId, versionId, changeRef); doReturn(new Response<>(Void.TYPE)).when(stateAdaptorMock).updateItemVersion(eq(context), eq (Space.PRIVATE), eq(itemId), eq(versionId), eq(mergeChange.getChangedVersion() .getItemVersion().getData()), any(Date.class)); itemVersionManagerImpl.resetRevision(context, itemId, versionId, changeRef); verifySaveChangedElements(itemId, versionId, Space.PRIVATE, mergeChange.getChangedElements()); }
@Test(expectedExceptions = ZusammenException.class) public void testResetRevisionOnNonExistingItem() { itemVersionManagerImpl.resetRevision(context, new Id(), new Id(), new Id("changeRef")); }
@Test(expectedExceptions = ZusammenException.class) public void testResetRevisionNonExisting() { Id itemId = new Id(); Id versionId = new Id(); mockNonExistingVersion(Space.PRIVATE, itemId, versionId); itemVersionManagerImpl.resetRevision(context, itemId, versionId, new Id("changeRef")); }