View Javadoc

1   /**
2    * Copyright 2011-2013 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15  package org.kuali.mobility.email.service;
16  
17  import org.apache.log4j.Logger;
18  import org.junit.AfterClass;
19  import org.junit.BeforeClass;
20  import org.junit.Test;
21  import org.springframework.context.ApplicationContext;
22  import org.springframework.context.support.FileSystemXmlApplicationContext;
23  
24  import static org.junit.Assert.assertTrue;
25  
26  /**
27   * @author Kuali Mobility Team (mobility.collab@kuali.org)
28   */
29  public class EmailServiceImplTest {
30      private static final Logger LOG = Logger.getLogger(EmailServiceImpl.class);
31  
32      private static ApplicationContext applicationContext;
33  
34      private static String[] getConfigLocations() {
35          return new String[] { "classpath:/EmailSpringBeans.xml" };
36      }
37  
38      @BeforeClass
39      public static void setUpClass() throws Exception {
40          EmailServiceImplTest.setApplicationContext(new FileSystemXmlApplicationContext(getConfigLocations()));
41      }
42  
43      @AfterClass
44      public static void tearDownClass() throws Exception {
45      }
46  
47      @Test
48      public void testSendEmail() {
49          EmailService service = (EmailService)getApplicationContext().getBean("emailService");
50          boolean response = service.sendEmail(null, null, null, null);
51          assertTrue( "Email not yet implemented.", !response);
52      }
53  
54      public static ApplicationContext getApplicationContext() {
55          return applicationContext;
56      }
57  
58      public static void setApplicationContext(ApplicationContext applicationContext) {
59          EmailServiceImplTest.applicationContext = applicationContext;
60      }
61  }