JdbcUtil { public static Properties mergeConnectionProperties(Properties p, String username, String password) throws PasswordException { if (!isEmpty(username)) { p.setProperty("user", username); } if (!isEmpty(password)) { p.setProperty("password", Password.decode(password)); } return p; }  static void closeQuietly(AutoCloseable... closeables); static void rollback(Savepoint svp, Connection sqlConnection); static void rollback(Connection sqlConnection); static void commit(Connection sqlConnection); static Savepoint createSavepoint(Connection sqlConnection); static Connection testConnection(Connection sqlConnection, String testStatement, boolean debugMode); static Properties mergeConnectionProperties(Properties p, String username, String password); static Connection getConnection(AdaptrisMessage msg, AdaptrisConnection adpCon); static void rollback(Connection sqlConnection, AdaptrisMessage msg); static void commit(Connection sqlConnection, AdaptrisMessage msg);  }
@Test(expected = PasswordException.class) public void testMergeProperties() throws Exception { Properties p = new Properties(); mergeConnectionProperties(p, "user", "password"); assertEquals("user", p.getProperty("user")); assertEquals("password", p.getProperty("password")); p = new Properties(); mergeConnectionProperties(p, "", ""); assertEquals(0, p.size()); mergeConnectionProperties(p, "", "ALTPW:ABCDEFGGHJ"); }