### Question:
DefaultMailSenderConfiguration implements MailSenderConfiguration { @Override public boolean usesAuthentication() { return !StringUtils.isEmpty(getUsername()) && !StringUtils.isEmpty(getPassword()); }  @Override String getHost(); @Override int getPort(); @Override String getUsername(); @Override String getPassword(); @Override List<String> getBCCAddresses(); @Override String getFromAddress(); @Override Properties getAdditionalProperties(); @Override Properties getAllProperties(); @Override boolean usesAuthentication(); @Override String getScriptServicePermissionCheckerHint(); @Override long getSendWaitTime(); @Override int getPrepareQueueCapacity(); @Override int getSendQueueCapacity(); static final String JAVAMAIL_TRANSPORT_PROTOCOL; static final String JAVAMAIL_SMTP_HOST; static final String JAVAMAIL_SMTP_PORT; static final String JAVAMAIL_SMTP_USERNAME; static final String JAVAMAIL_SMTP_AUTH; }### Answer:
@Test public void usesAuthenticationWhenUserNameAndPasswordExist() { when(this.mailConfigDocumentSource.getProperty("username", String.class)).thenReturn("user"); when(this.mailConfigDocumentSource.getProperty("password", String.class)).thenReturn("pass"); assertTrue(this.configuration.usesAuthentication()); }