List of usage examples for javax.mail Provider getClassName
public String getClassName()
From source file:com.formkiq.core.service.notification.MailSenderServiceTest.java
/** * testLoadMailProperties01()./*from www . jav a 2 s .c om*/ * @throws Exception Exception */ @Test public void testLoadMailProperties01() throws Exception { // given String ls = System.getProperty("line.separator"); String source = "mail.host=smtp.gmail.com" + ls + "mail.port=587" + ls + "mail.username=test@formkiq.com" + ls + "mail.password=test" + ls + "mail.smtp.auth=true" + ls + "mail.smtp.starttls.enable=true" + ls + "mail.smtp.quitwait=false"; InputStream in = IOUtils.toInputStream(source, "UTF-8"); Properties prop = new Properties(); prop.load(in); // when Session se = Session.getDefaultInstance(prop, null); Provider prov = se.getProvider("smtp"); Class<?> clazz = Class.forName(prov.getClassName()); // then assertNotNull(clazz); in.close(); }