### Question:
AmazonMailSender extends JavaMailSenderImpl { public void init() { final Properties props = getJavaMailProperties(); props.setProperty(MAIL_TRANSPORT_PROTOCOL_KEY, "aws"); props.setProperty(AWSJavaMailTransport.AWS_ACCESS_KEY_PROPERTY, awsCredentials.getAWSAccessKeyId()); props.setProperty(AWSJavaMailTransport.AWS_SECRET_KEY_PROPERTY, awsCredentials.getAWSSecretKey()); setPort(-1); } AmazonMailSender(final AWSCredentials awsCredentials); void init(); @Override Transport getTransport(final Session session);  }### Answer:
@Test public void shouldInitializeWithCredentialsAndTransport_givenAwsCredentials() { final String awsAccessKeyId = randomString(10); final String awsAccessSecretId = randomString(10); final AWSCredentials awsCredentials = new BasicAWSCredentials(awsAccessKeyId, awsAccessSecretId); final AmazonMailSender mailSender = new AmazonMailSender(awsCredentials); mailSender.init(); final Properties properties = mailSender.getJavaMailProperties(); assertEquals("aws", properties.getProperty("mail.transport.protocol")); assertEquals(awsAccessKeyId, properties.getProperty(AWSJavaMailTransport.AWS_ACCESS_KEY_PROPERTY)); assertEquals(awsAccessSecretId, properties.getProperty(AWSJavaMailTransport.AWS_SECRET_KEY_PROPERTY)); }