### Question:
PropertyAuthenticationProvider implements AuthenticationProvider { @Override public PasswordAuthentication getPasswordAuthentication() { return authentication; } PropertyAuthenticationProvider(Properties properties); @Override PasswordAuthentication getPasswordAuthentication();  }### Answer:
@Test public void testGetPasswordAuthentication() { String username = randomAscii(10); String password = randomAscii(20); properties.setProperty("Username", username); properties.setProperty("Password", password); final PropertyAuthenticationProvider authenticationProvider = new PropertyAuthenticationProvider(properties); final PasswordAuthentication authentication = authenticationProvider.getPasswordAuthentication(); assertThat(authentication, notNullValue()); assertThat(authentication.getUserName(), is(username)); assertThat(authentication.getPassword(), is(password.toCharArray())); }
@Test public void testNoAuthentication() { final PropertyAuthenticationProvider authenticationProvider = new PropertyAuthenticationProvider(properties); assertThat(authenticationProvider.getPasswordAuthentication(), nullValue()); }