Implementovaný parser na šablony e-mailů. Rozchozeny unit testy.
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
jdbc.driverClassName=com.mysql.jdbc.Driver
|
||||
jdbc.dialect=org.hibernate.dialect.MySQLDialect
|
||||
jdbc.databaseurl=jdbc:mysql://127.0.0.1:3306/isspst?characterEncoding=latin2&autoReconnect=true
|
||||
jdbc.username=isspst
|
||||
jdbc.password=xsacfgd
|
||||
@@ -0,0 +1,2 @@
|
||||
ldap.server=ldap://localhost:3089
|
||||
ldap.userDNPattern=uid=\{0\},OU=people,DC=bukova,DC=info
|
||||
@@ -0,0 +1,7 @@
|
||||
mail.from=josef.rokos@gmail.com
|
||||
mail.host=smtp.gmail.com
|
||||
mail.port=587
|
||||
mail.useauth=true
|
||||
mail.usessl=true
|
||||
mail.username=josef.rokos@gmail.com
|
||||
mail.password=XXXXX
|
||||
@@ -0,0 +1,35 @@
|
||||
package info.bukova.isspst.mail;
|
||||
|
||||
import info.bukova.isspst.data.Material;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = {"classpath:/test-context.xml"})
|
||||
public class MessageBuilderTest {
|
||||
|
||||
@Autowired
|
||||
private MessageBuilder messageBuilder;
|
||||
|
||||
@Test
|
||||
public void buildTest() {
|
||||
MailMessage template = new MailMessage();
|
||||
Material data = new Material();
|
||||
data.setCode("pokus");
|
||||
data.setDescription("popisek");
|
||||
|
||||
template.setSubject("predmet");
|
||||
template.setText("pokusnej text [code] s popiskem [description]");
|
||||
|
||||
MailMessage replaced = messageBuilder.buildMessage(template, data);
|
||||
|
||||
assertEquals("pokusnej text pokus s popiskem popisek", replaced.getText());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user