### Question:
KettleDatabaseRepositoryMeta extends BaseRepositoryMeta implements RepositoryMeta { @Override public void populate( Map<String, Object> properties, RepositoriesMeta repositoriesMeta ) { super.populate( properties, repositoriesMeta ); String databaseConnection = (String) properties.get( DATABASE_CONNECTION ); DatabaseMeta databaseMeta = repositoriesMeta.searchDatabase( databaseConnection ); if ( databaseMeta != null ) { setConnection( databaseMeta ); } } KettleDatabaseRepositoryMeta();  KettleDatabaseRepositoryMeta( String id, String name, String description, DatabaseMeta connection );  KettleDatabaseRepositoryMeta( String id ); RepositoryCapabilities getRepositoryCapabilities(); void setName( String name ); String getName(); void setDescription( String description ); String getDescription(); Boolean isDefault(); void setDefault( Boolean isDefault ); void setConnection( DatabaseMeta connection ); DatabaseMeta getConnection(); String getXML(); void loadXML( Node repnode, List<DatabaseMeta> databases ); RepositoryMeta clone(); @Override void populate( Map<String, Object> properties, RepositoriesMeta repositoriesMeta ); @SuppressWarnings( "unchecked" ) @Override JSONObject toJSONObject(); static final String ID; static final String DATABASE_CONNECTION; static String REPOSITORY_TYPE_ID; }### Answer:
@Test public void testPopulate() throws Exception { kettleDatabaseRepositoryMeta.setConnection( databaseMeta ); when( databaseMeta.getName() ).thenReturn( DATABASE_CONNECTION ); when( repositoriesMeta.searchDatabase( DATABASE_CONNECTION ) ).thenReturn( databaseMeta ); Map<String, Object> properties = new HashMap<>(); properties.put( "displayName", NAME ); properties.put( "description", DESCRIPTION ); properties.put( "databaseConnection", DATABASE_CONNECTION ); properties.put( "isDefault", true ); kettleDatabaseRepositoryMeta.populate( properties, repositoriesMeta ); assertEquals( NAME, kettleDatabaseRepositoryMeta.getName() ); assertEquals( DESCRIPTION, kettleDatabaseRepositoryMeta.getDescription() ); assertEquals( DATABASE_CONNECTION, kettleDatabaseRepositoryMeta.getConnection().getName() ); assertEquals( true, kettleDatabaseRepositoryMeta.isDefault() ); }