James Moger
2012-10-01 eb1405f736f2f98e14215774dd53eea9b9a77017
commit | author | age
7e099b 1 /*
JM 2  * Copyright 2011 gitblit.com.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.gitblit.tests;
17
7e8873 18 import static org.junit.Assert.assertTrue;
JM 19
7e099b 20 import javax.mail.Message;
JM 21
7e8873 22 import org.junit.Test;
7e099b 23
JM 24 import com.gitblit.FileSettings;
25 import com.gitblit.MailExecutor;
26
7e8873 27 public class MailTest {
7e099b 28
7e8873 29     @Test
7e099b 30     public void testSendMail() throws Exception {
JM 31         FileSettings settings = new FileSettings("mailtest.properties");
32         MailExecutor mail = new MailExecutor(settings);
33         Message message = mail.createMessageForAdministrators();
34         message.setSubject("Test");
35         message.setText("this is a test");
36         mail.queue(message);
7e8873 37         mail.run();
7e099b 38
JM 39         assertTrue("mail queue is not empty!", mail.hasEmptyQueue());
40     }
41 }