@Test
public void testGetPasswordAuthentication()
{

    System.out.println("getPasswordAuthentication");
    ConfigurationService cfg = getKernel().getConfigurationService();
    // Save existing values.
    String oldUsername = cfg.getProperty(CFG_USERNAME);
    String oldPassword = cfg.getProperty(CFG_PASSWORD);
    // Set known values.
    cfg.setProperty(CFG_USERNAME, USERNAME);
    cfg.setProperty(CFG_PASSWORD, PASSWORD);
    EmailServiceImpl instance = (EmailServiceImpl) getService(EmailServiceImpl.class);
    PasswordAuthentication result = instance.getPasswordAuthentication();
    assertNotNull(" null returned", result);
    assertEquals(" username does not match configuration", result.getUserName(), USERNAME);
    assertEquals(" password does not match configuration", result.getPassword(), PASSWORD);
    // Restore old values, if any.
    cfg.setProperty(CFG_USERNAME, oldUsername);
    cfg.setProperty(CFG_PASSWORD, oldPassword);
}