### Question:
GenericURLConnection extends URLConnection { protected String getPassword() { String userInfo = this.m_url.getUserInfo(); if (userInfo != null) { if (userInfo.contains(USERINFO_DELIMITER)) { String[] userPass = userInfo.split(USERINFO_DELIMITER); return userPass[1]; } else { logger.warn("Only user name without password configured. Return empty string as password"); return EMPTY_STRING; } } else { logger.warn("No credentials for URL connection configured."); return null; } } protected  GenericURLConnection(URL url);   }### Answer:
@Test public void testBaseUrlPassword() { m_genericURLConnection = new StubGenericURLConnection(m_baseUrl); assertNull("Test base URL", m_genericURLConnection.getPassword()); }
@Test public void testUserOnlyUrlPassword() { m_genericURLConnection = new StubGenericURLConnection(m_userOnlyUrl); assertEquals("Test user only URL", m_genericURLConnection.getPassword(), ""); }
@Test public void testUserPassUrlPassword() { m_genericURLConnection = new StubGenericURLConnection(m_userPassUrl); assertEquals("Test user pass URL", m_genericURLConnection.getPassword(), "pass"); }