@Test public void getAllProperties() { when(this.mailConfigDocumentSource.getProperty("properties", String.class)).thenReturn( "mail.smtp.starttls.enable=true"); when(this.mailConfigDocumentSource.getProperty("username", String.class)).thenReturn(null); when(this.mailConfigDocumentSource.getProperty("password", String.class)).thenReturn(null); when(this.mailConfigDocumentSource.getProperty("host", String.class)).thenReturn("server"); when(this.mailConfigDocumentSource.getProperty("port", Integer.class)).thenReturn(25); when(this.mailConfigDocumentSource.getProperty("from", String.class)).thenReturn("john@doe.com"); Properties returnedProperties = this.configuration.getAllProperties(); assertEquals(4, returnedProperties.size()); assertEquals("true", returnedProperties.getProperty("mail.smtp.starttls.enable")); assertEquals("server", returnedProperties.getProperty("mail.smtp.host")); assertEquals("25", returnedProperties.getProperty("mail.smtp.port")); assertEquals("smtp", returnedProperties.getProperty("mail.transport.protocol")); assertNull(returnedProperties.getProperty("mail.smtp.from")); assertNull(returnedProperties.getProperty("mail.smtp.user")); }
@Override public Properties getAllProperties() { Properties properties = new Properties(); addProperty(properties, JAVAMAIL_TRANSPORT_PROTOCOL, "smtp"); addProperty(properties, JAVAMAIL_SMTP_HOST, getHost()); addProperty(properties, JAVAMAIL_SMTP_USERNAME, getUsername()); addProperty(properties, JAVAMAIL_SMTP_PORT, Integer.toString(getPort())); if (usesAuthentication()) { properties.put(JAVAMAIL_SMTP_AUTH, "true"); } properties.putAll(getAdditionalProperties()); return properties; }
DefaultMailSenderConfiguration implements MailSenderConfiguration { @Override public Properties getAllProperties() { Properties properties = new Properties(); addProperty(properties, JAVAMAIL_TRANSPORT_PROTOCOL, "smtp"); addProperty(properties, JAVAMAIL_SMTP_HOST, getHost()); addProperty(properties, JAVAMAIL_SMTP_USERNAME, getUsername()); addProperty(properties, JAVAMAIL_SMTP_PORT, Integer.toString(getPort())); if (usesAuthentication()) { properties.put(JAVAMAIL_SMTP_AUTH, "true"); } properties.putAll(getAdditionalProperties()); return properties; } }
DefaultMailSenderConfiguration implements MailSenderConfiguration { @Override public Properties getAllProperties() { Properties properties = new Properties(); addProperty(properties, JAVAMAIL_TRANSPORT_PROTOCOL, "smtp"); addProperty(properties, JAVAMAIL_SMTP_HOST, getHost()); addProperty(properties, JAVAMAIL_SMTP_USERNAME, getUsername()); addProperty(properties, JAVAMAIL_SMTP_PORT, Integer.toString(getPort())); if (usesAuthentication()) { properties.put(JAVAMAIL_SMTP_AUTH, "true"); } properties.putAll(getAdditionalProperties()); return properties; }  }
DefaultMailSenderConfiguration implements MailSenderConfiguration { @Override public Properties getAllProperties() { Properties properties = new Properties(); addProperty(properties, JAVAMAIL_TRANSPORT_PROTOCOL, "smtp"); addProperty(properties, JAVAMAIL_SMTP_HOST, getHost()); addProperty(properties, JAVAMAIL_SMTP_USERNAME, getUsername()); addProperty(properties, JAVAMAIL_SMTP_PORT, Integer.toString(getPort())); if (usesAuthentication()) { properties.put(JAVAMAIL_SMTP_AUTH, "true"); } properties.putAll(getAdditionalProperties()); return properties; }  @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(); }
DefaultMailSenderConfiguration implements MailSenderConfiguration { @Override public Properties getAllProperties() { Properties properties = new Properties(); addProperty(properties, JAVAMAIL_TRANSPORT_PROTOCOL, "smtp"); addProperty(properties, JAVAMAIL_SMTP_HOST, getHost()); addProperty(properties, JAVAMAIL_SMTP_USERNAME, getUsername()); addProperty(properties, JAVAMAIL_SMTP_PORT, Integer.toString(getPort())); if (usesAuthentication()) { properties.put(JAVAMAIL_SMTP_AUTH, "true"); } properties.putAll(getAdditionalProperties()); return properties; }  @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; }