1 package br.org.articulus.server;
2
3 import org.springframework.context.ApplicationContext;
4 import org.springframework.context.ConfigurableApplicationContext;
5 import org.springframework.context.support.ClassPathXmlApplicationContext;
6 import org.springframework.test.AbstractSpringContextTests;
7
8
9
10
11
12
13
14 public class SendMailTest extends AbstractSpringContextTests {
15
16 private SendMail sendMail;
17 private ApplicationContext ctx;
18
19
20
21
22
23
24
25 protected void setUp() throws Exception {
26 ctx = loadContext(
27 new String[] {"applicationContext-javamail.xml"});
28 }
29
30
31
32
33
34
35
36 public void testSend() {
37 String to = "andersonajx@gmail.com";
38 String subject = "TestCase";
39 String msg = "Sended by testcase of Spring";
40
41 sendMail = (SendMail)ctx.getBean("sendMail");
42 sendMail.send(to,subject,msg);
43
44 assertNotNull(to);
45 assertNotNull(subject);
46 assertNotNull(msg);
47 }
48
49
50
51
52
53
54
55 protected ConfigurableApplicationContext loadContext(Object arg0)
56 throws Exception {
57 return new ClassPathXmlApplicationContext((String[])arg0);
58 }
59
60 }