diff --git a/pom.xml b/pom.xml
index fe4a45d7..a39e85ea 100644
--- a/pom.xml
+++ b/pom.xml
@@ -80,6 +80,11 @@
spring-security-ldap
${org.springframework-version}
+
+ org.springframework
+ spring-test
+ ${org.springframework-version}
+
diff --git a/src/test/java/WEB-INF/jdbc.properties b/src/test/java/WEB-INF/jdbc.properties
new file mode 100644
index 00000000..4e3ec948
--- /dev/null
+++ b/src/test/java/WEB-INF/jdbc.properties
@@ -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
\ No newline at end of file
diff --git a/src/test/java/WEB-INF/ldap.properties b/src/test/java/WEB-INF/ldap.properties
new file mode 100644
index 00000000..4060b43d
--- /dev/null
+++ b/src/test/java/WEB-INF/ldap.properties
@@ -0,0 +1,2 @@
+ldap.server=ldap://localhost:3089
+ldap.userDNPattern=uid=\{0\},OU=people,DC=bukova,DC=info
\ No newline at end of file
diff --git a/src/test/java/WEB-INF/mail.properties b/src/test/java/WEB-INF/mail.properties
new file mode 100644
index 00000000..260c67ee
--- /dev/null
+++ b/src/test/java/WEB-INF/mail.properties
@@ -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
\ No newline at end of file
diff --git a/src/test/java/info/bukova/isspst/mail/MessageBuilderTest.java b/src/test/java/info/bukova/isspst/mail/MessageBuilderTest.java
new file mode 100644
index 00000000..62f98d88
--- /dev/null
+++ b/src/test/java/info/bukova/isspst/mail/MessageBuilderTest.java
@@ -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());
+ }
+
+}
diff --git a/src/test/resources/test-context.xml b/src/test/resources/test-context.xml
new file mode 100644
index 00000000..aa00b5ff
--- /dev/null
+++ b/src/test/resources/test-context.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+