### Question:
JobEntryAnalyzer extends BaseKettleMetaverseComponent implements
  IClonableJobEntryAnalyzer<IMetaverseNode, T> { protected void addConnectionNodes( IComponentDescriptor descriptor ) throws MetaverseAnalyzerException { if ( jobEntryInterface == null ) { throw new MetaverseAnalyzerException( Messages.getString( "ERROR.JobEntryInterface.IsNull" ) ); } if ( connectionAnalyzer != null ) { List<? extends Object> connections = connectionAnalyzer.getUsedConnections( jobEntryInterface ); for ( Object connection : connections ) { String connName = null; try { Method getNameMethod = connection.getClass().getMethod( "getName", null ); connName = (String) getNameMethod.invoke( connection, null ); } catch ( Exception e ) { } try { IComponentDescriptor connDescriptor = connectionAnalyzer.buildComponentDescriptor( descriptor, connection ); connName = connName == null ? descriptor.getName() : connName; IMetaverseNode connNode = connectionAnalyzer.analyze( connDescriptor, connection ); metaverseBuilder.addLink( connNode, DictionaryConst.LINK_DEPENDENCYOF, rootNode ); } catch ( Throwable t ) { LOGGER.warn( Messages.getString( "WARNING.AnalyzingDatabaseConnection", connName ), t ); } } } }  @Override IMetaverseNode analyze( IComponentDescriptor descriptor, T entry ); IConnectionAnalyzer<Object, T> getConnectionAnalyzer(); void setConnectionAnalyzer( IConnectionAnalyzer<Object, T> connectionAnalyzer ); IComponentDescriptor getDescriptor(); void setDescriptor( IComponentDescriptor descriptor ); @Override final IClonableJobEntryAnalyzer cloneAnalyzer(); @Override void setDocumentAnalyzer( final IClonableDocumentAnalyzer documentAnalyzer ); @Override IClonableDocumentAnalyzer getDocumentAnalyzer(); @Override void setDocumentDescriptor( final IComponentDescriptor documentDescriptor ); @Override void setDocumentPath( final String documentPath ); @Override IComponentDescriptor getDocumentDescriptor();  }### Answer:
@Test( expected = MetaverseAnalyzerException.class ) public void addConnectionNodesWithNullStep() throws MetaverseAnalyzerException { analyzer.addConnectionNodes( mockDescriptor ); }
@Test public void testAddConnectionNodesException() throws MetaverseAnalyzerException { analyzer.jobEntryInterface = mock( JobEntryInterface.class ); when( mockDescriptor.getContext() ).thenThrow( Exception.class ); analyzer.addConnectionNodes( mockDescriptor ); }
@Test public void addConnectionNodes() throws MetaverseAnalyzerException { DatabaseMeta[] dbs = new DatabaseMeta[] { mockDatabaseMeta }; analyzer.jobEntryInterface = mockJobEntryInterface; DatabaseConnectionAnalyzer dbAnalyzer = new JobEntryDatabaseConnectionAnalyzer(); dbAnalyzer.setMetaverseBuilder( mockBuilder ); analyzer.setConnectionAnalyzer( dbAnalyzer ); when( analyzer.getConnectionAnalyzer() ).thenReturn( dbAnalyzer ); when( mockJobEntryInterface.getUsedDatabaseConnections() ).thenReturn( dbs ); analyzer.addConnectionNodes( mockDescriptor ); }