### Question:
DefaultMailSenderConfiguration implements MailSenderConfiguration { @Override public int getPort() { Integer port = this.currentWikiMailConfigSource.getProperty(PORT_PROPERTY, Integer.class); if (port == null && !isMainWiki()) { port = this.mainWikiMailConfigSource.getProperty(PORT_PROPERTY, Integer.class); } if (port == null) { port = this.xwikiPropertiesSource.getProperty(PREFIX + PORT_PROPERTY, DEFAULT_PORT); } return port; }  @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 getPortFromXWikiPreferences() { when(this.mailConfigDocumentSource.getProperty("port", Integer.class)).thenReturn(25); assertEquals(25, this.configuration.getPort()); }
@Test public void getPortWhenMailConfigDoesntExist() { when(this.xwikiPropertiesSource.getProperty("mail.sender.port", 25)).thenReturn(25); assertEquals(25, this.configuration.getPort()); }