MetadataRetryContext { public void updateRetryContext( String stepKey, String message, MetadataVersion version ) { retryContext.setAttribute( stepKey, message ); if ( version != null ) { retryContext.setAttribute( MetadataSyncJob.VERSION_KEY, version ); } }  RetryContext getRetryContext(); void setRetryContext( RetryContext retryContext ); void updateRetryContext( String stepKey,
        String message, MetadataVersion version ); void updateRetryContext( String stepKey, String message, MetadataVersion version, MetadataSyncSummary summary );  }
@Test public void testIfVersionIsNull() throws Exception { metadataRetryContext.updateRetryContext( testKey, testMessage, null ); verify( retryContext ).setAttribute( testKey, testMessage ); verify( retryContext, never() ).setAttribute( MetadataSyncJob.VERSION_KEY, null ); }
@Test public void testIfVersionIsNotNull() throws Exception { metadataRetryContext.updateRetryContext( testKey, testMessage, mockVersion ); verify( retryContext ).setAttribute( testKey, testMessage ); verify( retryContext ).setAttribute( MetadataSyncJob.VERSION_KEY, mockVersion ); }
@Test public void testIfSummaryIsNull() throws Exception { MetadataSyncSummary metadataSyncSummary = mock( MetadataSyncSummary.class ); metadataRetryContext.updateRetryContext( testKey, testMessage, mockVersion, null ); verify( retryContext ).setAttribute( testKey, testMessage ); verify( metadataSyncSummary, never() ).getImportReport(); }
@Test public void testIfSummaryIsNotNull() throws Exception { MetadataSyncSummary testSummary = new MetadataSyncSummary(); ImportReport importReport = new ImportReport(); importReport.setStatus( Status.ERROR ); testSummary.setImportReport( importReport ); metadataRetryContext.updateRetryContext( testKey, testMessage, mockVersion, testSummary ); verify( retryContext ).setAttribute( testKey, testMessage ); }