### Question:
AmazonMailSender extends JavaMailSenderImpl { @Override public Transport getTransport(final Session session) throws NoSuchProviderException { return new AWSJavaMailTransport(session, null); } AmazonMailSender(final AWSCredentials awsCredentials); void init(); @Override Transport getTransport(final Session session);  }### Answer:
@Test public void shouldGetTransport_withSession() throws Exception { final String awsAccessKeyId = randomString(10); final String awsAccessSecretId = randomString(10); final AWSCredentials awsCredentials = new BasicAWSCredentials(awsAccessKeyId, awsAccessSecretId); final AmazonMailSender mailSender = new AmazonMailSender(awsCredentials); final Session mockSession = Session.getDefaultInstance(mock(Properties.class)); final Transport transport = mailSender.getTransport(mockSession); assertNotNull(transport); assertTrue(transport instanceof AWSJavaMailTransport); }