### Question:
MongoDbConnectionAnalyzer extends BaseKettleMetaverseComponent implements
  IConnectionAnalyzer<MongoDbMeta, MongoDbMeta> { @Override public IMetaverseNode analyze( IComponentDescriptor descriptor, MongoDbMeta mongoDbMeta ) throws MetaverseAnalyzerException { IMetaverseNode datasourceNode = createNodeFromDescriptor( descriptor ); String database = mongoDbMeta.getDbName(); String port = mongoDbMeta.getPort(); String hostNames = mongoDbMeta.getHostnames(); String user = mongoDbMeta.getAuthenticationUser(); boolean useAllReplicaSetMembers = mongoDbMeta.getUseAllReplicaSetMembers(); boolean useKerberosAuthentication = mongoDbMeta.getUseKerberosAuthentication(); String connectTimeout = mongoDbMeta.getConnectTimeout(); String socketTimeout = mongoDbMeta.getSocketTimeout(); datasourceNode.setProperty( HOST_NAMES, hostNames ); datasourceNode.setProperty( DATABASE_NAME, database ); datasourceNode.setProperty( DictionaryConst.PROPERTY_USER_NAME, user ); datasourceNode.setProperty( DictionaryConst.PROPERTY_PORT, port ); datasourceNode.setProperty( USE_ALL_REPLICA_SET_MEMBERS, useAllReplicaSetMembers ); datasourceNode.setProperty( USE_KERBEROS_AUTHENTICATION, useKerberosAuthentication ); datasourceNode.setProperty( CONNECTION_TIMEOUT, connectTimeout ); datasourceNode.setProperty( SOCKET_TIMEOUT, socketTimeout ); datasourceNode.setName( database ); datasourceNode.setType( DictionaryConst.NODE_TYPE_MONGODB_CONNECTION ); datasourceNode.setLogicalIdGenerator( getLogicalIdGenerator() ); return datasourceNode; }  @Override IMetaverseNode analyze( IComponentDescriptor descriptor, MongoDbMeta mongoDbMeta ); @Override List<MongoDbMeta> getUsedConnections( MongoDbMeta meta ); @Override IComponentDescriptor buildComponentDescriptor( IComponentDescriptor parentDescriptor,
                                                        MongoDbMeta connection ); static final String HOST_NAMES; static final String DATABASE_NAME; static final String USE_ALL_REPLICA_SET_MEMBERS; static final String USE_KERBEROS_AUTHENTICATION; static final String CONNECTION_TIMEOUT; static final String SOCKET_TIMEOUT; static final ILogicalIdGenerator ID_GENERATOR; }### Answer:
@Test public void testAnalyze() throws Exception { when( mockBuilder.addNode( any( IMetaverseNode.class ) ) ).thenAnswer( new Answer<Object>() { @Override public Object answer( InvocationOnMock invocation ) throws Throwable { Object[] args = invocation.getArguments(); IMetaverseNode node = (IMetaverseNode)args[0]; node.setProperty( DictionaryConst.PROPERTY_LOGICAL_ID, node.getLogicalId() ); return mockBuilder; } } ); IMetaverseNode node = analyzer.analyze( mockDescriptor, mongoDbMeta ); assertNotNull( node ); assertEquals( "localhost", node.getProperty( MongoDbConnectionAnalyzer.HOST_NAMES ) ); assertEquals( "db", node.getProperty( MongoDbConnectionAnalyzer.DATABASE_NAME ) ); assertEquals( "user", node.getProperty( DictionaryConst.PROPERTY_USER_NAME ) ); assertEquals( "12345", node.getProperty( DictionaryConst.PROPERTY_PORT ) ); }