### Question:
UnifiedRepositoryPurgeService implements IPurgeService { @Override public void deleteVersionsBeforeDate( RepositoryElementInterface element, Date beforeDate ) throws KettleException { try { Serializable fileId = element.getObjectId().getId(); deleteVersionsBeforeDate( fileId, beforeDate ); } catch ( Exception e ) { processDeleteException( e ); } } UnifiedRepositoryPurgeService( IUnifiedRepository unifiedRepository ); @Override void deleteVersionsBeforeDate( RepositoryElementInterface element, Date beforeDate ); @Override void deleteVersionsBeforeDate( Serializable fileId, Date beforeDate ); @Override void deleteAllVersions( RepositoryElementInterface element ); @Override void deleteAllVersions( Serializable fileId ); @Override void deleteVersion( RepositoryElementInterface element, String versionId ); @Override void deleteVersion( Serializable fileId, Serializable versionId ); @Override void keepNumberOfVersions( RepositoryElementInterface element, int versionCount ); @Override void keepNumberOfVersions( Serializable fileId, int versionCount ); void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ); static DefaultUnifiedRepositoryWebService getRepoWs(); static DefaultUnifiedRepositoryWebService repoWs; }### Answer:
@Test public void deleteVersionsBeforeDate() throws KettleException { IUnifiedRepository mockRepo = mock( IUnifiedRepository.class ); final HashMap<String, List<VersionSummary>> versionListMap = processVersionMap( mockRepo ); UnifiedRepositoryPurgeService purgeService = new UnifiedRepositoryPurgeService( mockRepo ); String fileId = "1"; Date beforeDate = getDate( "01/02/2006" ); purgeService.deleteVersionsBeforeDate( element1, beforeDate ); verifyDateBeforeDeletion( versionListMap, mockRepo, fileId, beforeDate ); verify( mockRepo, never() ).deleteFileAtVersion( eq( "2" ), anyString() ); }