DefaultMetadataVersionService implements MetadataVersionService { @Override @Transactional( readOnly = true ) public String getVersionData( String versionName ) { KeyJsonValue keyJsonValue = metaDataKeyJsonService.getMetaDataVersion( versionName ); if ( keyJsonValue != null ) { try { return renderService.fromJson( keyJsonValue.getValue(), MetadataWrapper.class ).getMetadata(); } catch ( IOException e ) { log.error( "Exception occurred while deserializing metadata.", e ); } } return null; } 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 public void testShouldReturnNullWhenAVersionDoesNotExist() throws Exception { assertEquals( null, versionService.getVersionData( "myNonExistingVersion" ) ); }