### Question:
ConnectionPoolUtil { protected static String buildPoolName( DatabaseMeta dbMeta, String partitionId ) { return dbMeta.getName() + Const.NVL( dbMeta.getDatabaseName(), "" ) + Const.NVL( dbMeta.getHostname(), "" ) + Const.NVL( dbMeta.getDatabasePortNumberString(), "" ) + Const.NVL( partitionId, "" ); }  static Connection getConnection( LogChannelInterface log, DatabaseMeta dbMeta, String partitionId ); static Connection getConnection( LogChannelInterface log, DatabaseMeta dbMeta, String partitionId,
      int initialSize, int maximumSize ); static final String DEFAULT_AUTO_COMMIT; static final String DEFAULT_READ_ONLY; static final String DEFAULT_TRANSACTION_ISOLATION; static final String DEFAULT_CATALOG; static final String INITIAL_SIZE; static final String MAX_ACTIVE; static final String MAX_IDLE; static final String MIN_IDLE; static final String MAX_WAIT; static final String VALIDATION_QUERY; static final String TEST_ON_BORROW; static final String TEST_ON_RETURN; static final String TEST_WHILE_IDLE; static final String TIME_BETWEEN_EVICTION_RUNS_MILLIS; static final String POOL_PREPARED_STATEMENTS; static final String MAX_OPEN_PREPARED_STATEMENTS; static final String ACCESS_TO_UNDERLYING_CONNECTION_ALLOWED; static final String REMOVE_ABANDONED; static final String REMOVE_ABANDONED_TIMEOUT; static final String LOG_ABANDONED; static final int defaultInitialNrOfConnections; static final int defaultMaximumNrOfConnections; }### Answer:
@Test public void testGetConnectionName() throws Exception { when( dbMeta.getName() ).thenReturn( "CP2" ); when( dbMeta.getPassword() ).thenReturn( ENCR_PASSWORD ); String connectionName = ConnectionPoolUtil.buildPoolName( dbMeta, "" ); assertTrue( connectionName.equals( "CP2" ) ); assertFalse( connectionName.equals( "CP2pentaho" ) ); when( dbMeta.getDatabaseName() ).thenReturn( "pentaho" ); connectionName = ConnectionPoolUtil.buildPoolName( dbMeta, "" ); assertTrue( connectionName.equals( "CP2pentaho" ) ); assertFalse( connectionName.equals( "CP2pentaholocal" ) ); when( dbMeta.getHostname() ).thenReturn( "local" ); connectionName = ConnectionPoolUtil.buildPoolName( dbMeta, "" ); assertTrue( connectionName.equals( "CP2pentaholocal" ) ); assertFalse( connectionName.equals( "CP2pentaholocal3306" ) ); when( dbMeta.getDatabasePortNumberString() ).thenReturn( "3306" ); connectionName = ConnectionPoolUtil.buildPoolName( dbMeta, "" ); assertTrue( connectionName.equals( "CP2pentaholocal3306" ) ); }