MetadataSyncPreProcessor { public MetadataVersion handleCurrentMetadataVersion( MetadataRetryContext context ) { log.debug( "Getting the current version of the system" ); MetadataVersion metadataVersion; try { metadataVersion = metadataVersionService.getCurrentVersion(); log.info( "Current Metadata Version of the system: " + metadataVersion ); } catch ( MetadataVersionServiceException ex ) { context.updateRetryContext( MetadataSyncJob.GET_METADATAVERSION, ex.getMessage(), null, null ); throw new MetadataSyncServiceException( ex.getMessage(), ex ); } return metadataVersion; } MetadataSyncPreProcessor(
        SystemSettingManager systemSettingManager,
        MetadataVersionService metadataVersionService,
        MetadataVersionDelegate metadataVersionDelegate,
        TrackerSynchronization trackerSync,
        EventSynchronization eventSync,
        DataValueSynchronization dataValueSync,
        CompleteDataSetRegistrationSynchronization completeDataSetRegistrationSync ); void setUp( MetadataRetryContext context ); void handleDataValuePush( MetadataRetryContext context, MetadataSyncJobParameters jobParameters ); void handleTrackerProgramsDataPush( MetadataRetryContext context, MetadataSyncJobParameters jobParameters ); void handleEventProgramsDataPush( MetadataRetryContext context, MetadataSyncJobParameters jobParameters ); List<MetadataVersion> handleMetadataVersionsList( MetadataRetryContext context, MetadataVersion metadataVersion ); MetadataVersion handleCurrentMetadataVersion( MetadataRetryContext context ); void handleCompleteDataSetRegistrationDataPush( MetadataRetryContext context );  }
@Test public void testHandleCurrentMetadataVersionShouldReturnCurrentVersionOfSystem() throws Exception { MetadataRetryContext mockRetryContext = mock( MetadataRetryContext.class ); MetadataVersion currentVersion = new MetadataVersion(); currentVersion.setType( VersionType.BEST_EFFORT ); currentVersion.setName( "test_version" ); currentVersion.setCreated( new Date() ); currentVersion.setHashCode( "samplehashcode" ); when( metadataVersionService.getCurrentVersion() ).thenReturn( currentVersion ); MetadataVersion actualVersion = metadataSyncPreProcessor.handleCurrentMetadataVersion( mockRetryContext ); assertEquals( currentVersion, actualVersion ); }