TransImportExtensionPointPlugin implements ExtensionPointInterface { @Override public void callExtensionPoint( LogChannelInterface log, Object o ) throws KettleException { if ( !( o instanceof TransMeta ) ) { return; } TransMeta transMeta = (TransMeta) o; referenceSynchronizer.sync( transMeta, getExceptionHandler( log ), true ); } TransImportExtensionPointPlugin( DataServiceReferenceSynchronizer referenceSynchronizer ); @Override void callExtensionPoint( LogChannelInterface log, Object o );  }
@Test public void callExtensionPoint() throws Exception { DataServiceReferenceSynchronizer referenceSynchronizer = mock( DataServiceReferenceSynchronizer.class ); TransMeta transMeta = mock( TransMeta.class ); Repository transRepository = mock( Repository.class ); IMetaStore transMetaStore = mock( IMetaStore.class ); when( transRepository.getMetaStore() ).thenReturn( transMetaStore ); when( transMeta.getRepository() ).thenReturn( transRepository ); when( transMeta.getMetaStore() ).thenReturn( transMetaStore ); TransImportExtensionPointPlugin plugin = new TransImportExtensionPointPlugin( referenceSynchronizer ); LogChannelInterface log = mock( LogChannelInterface.class ); plugin.callExtensionPoint( log, null ); verify( referenceSynchronizer, times( 0 ) ).sync( same( transMeta ), any( Function.class ), eq( true ) ); plugin.callExtensionPoint( log, "Not TransMeta" ); verify( referenceSynchronizer, times( 0 ) ).sync( same( transMeta ), any( Function.class ), eq( true ) ); plugin.callExtensionPoint( log, transMeta ); ArgumentCaptor<Function> exceptionHandlerCaptor = ArgumentCaptor.forClass( Function.class ); verify( referenceSynchronizer ).sync( same( transMeta ), exceptionHandlerCaptor.capture(), eq( true ) ); Exception e = new Exception(); exceptionHandlerCaptor.getValue().apply( e ); verify( log ).logError( anyString(), same( e ) ); DataServiceMeta dsMeta = mock( DataServiceMeta.class ); DataServiceAlreadyExistsException dsaee = new DataServiceAlreadyExistsException( dsMeta ); exceptionHandlerCaptor.getValue().apply( dsaee ); verify( log ).logBasic( anyString() ); }