DefaultMetadataVersionService implements MetadataVersionService { @Override public boolean isMetadataPassingIntegrity( MetadataVersion version, String versionSnapshot ) { String metadataVersionHashCode; if ( version == null || versionSnapshot == null ) { throw new MetadataVersionServiceException( "Version/Version Snapshot can't be null" ); } try { metadataVersionHashCode = HashCodeGenerator.getHashCode( versionSnapshot ); } catch ( NoSuchAlgorithmException e ) { throw new MetadataVersionServiceException( "Algorithm to hash metadata is not found in the system", e ); } return (metadataVersionHashCode.equals( version.getHashCode() )); } DefaultMetadataVersionService( MetadataVersionStore metadataVersionStore,
        MetadataExportService metadataExportService, MetadataKeyJsonService metaDataKeyJsonService,
        NodeService nodeService, MetadataSystemSettingService metadataSystemSettingService,
        RenderService renderService ); @Override @Transactional long addVersion( MetadataVersion version ); @Override @Transactional void updateVersion( MetadataVersion version ); @Override @Transactional void updateVersionName( long id, String name ); @Override @Transactional void deleteVersion( MetadataVersion version ); @Override @Transactional( readOnly = true ) MetadataVersion getVersionById( long id ); @Override @Transactional( readOnly = true ) MetadataVersion getVersionByName( String versionName ); @Override @Transactional( readOnly = true ) List<MetadataVersion> getAllVersions(); @Override @Transactional( readOnly = true ) MetadataVersion getCurrentVersion(); @Override @Transactional( readOnly = true ) MetadataVersion getInitialVersion(); @Override @Transactional( readOnly = true ) List<MetadataVersion> getAllVersionsInBetween( Date startDate, Date endDate ); @Override @Transactional( readOnly = true ) Date getCreatedDate( String versionName ); @Override @Transactional synchronized boolean saveVersion( VersionType versionType ); @Override @Transactional( readOnly = true ) String getVersionData( String versionName ); @Override @Transactional void createMetadataVersionInDataStore( String versionName, String versionSnapshot ); @Override @Transactional void deleteMetadataVersionInDataStore( String nameSpaceKey ); @Override boolean isMetadataPassingIntegrity( MetadataVersion version, String versionSnapshot );  }
@Test( expected = MetadataVersionServiceException.class ) public void shouldThrowAnExceptionWhenVersionAndItsShanpShotAreNull() { versionService.isMetadataPassingIntegrity( null, null ); }