@@ -0,0 +1,2317 @@
+package org.datacite.mds.service.impl;%0A%0Aimport java.util.concurrent.ExecutionException;%0Aimport java.util.concurrent.Future;%0A%0Aimport org.datacite.mds.mail.MailMessage;%0Aimport org.easymock.EasyMock;%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.mail.MailException;%0Aimport org.springframework.mail.MailSendException;%0Aimport org.springframework.mail.MailSender;%0Aimport org.springframework.test.context.ContextConfiguration;%0Aimport org.springframework.test.context.junit4.SpringJUnit4ClassRunner;%0A%0A@RunWith(SpringJUnit4ClassRunner.class)%0A@ContextConfiguration(%22/META-INF/spring/applicationContext.xml%22)%0Apublic class MailServiceImplTest %7B%0A%0A    @Autowired%0A    private MailServiceImpl service;%0A%0A    private MailMessage mail;%0A%0A    private MailSender mockMailSender;%0A%0A    @Before%0A    public void init() %7B%0A        mail = new MailMessage();%0A        mockMailSender = EasyMock.createMock(MailSender.class);%0A        service.mailSender = mockMailSender;%0A    %7D%0A%0A    @After%0A    public void after() %7B%0A        EasyMock.verify(mockMailSender);%0A    %7D%0A%0A    @Test%0A    public void send() %7B%0A        mockMailSender.send(mail);%0A        EasyMock.replay(mockMailSender);%0A        service.send(mail);%0A    %7D%0A%0A    @Test(expected = MailException.class)%0A    public void sendMailException() %7B%0A        mockMailSender.send(mail);%0A        MailException ex = new MailSendException(%22foobar%22);%0A        EasyMock.expectLastCall().andThrow(ex);%0A        EasyMock.replay(mockMailSender);%0A        service.send(mail);%0A    %7D%0A%0A    @Test%0A    public void sendAsync() throws Exception %7B%0A        mockMailSender.send(mail);%0A        EasyMock.replay(mockMailSender);%0A        Future%3CObject%3E result = service.sendAsync(mail);%0A        result.get();%0A    %7D%0A%0A    @Test(expected = MailException.class)%0A    public void sendAsyncMailException() throws Throwable %7B%0A        mockMailSender.send(mail);%0A        MailException ex = new MailSendException(%22foobar%22);%0A        EasyMock.expectLastCall().andThrow(ex);%0A        EasyMock.replay(mockMailSender);%0A        Future%3CObject%3E result = service.sendAsync(mail);%0A        try %7B%0A            result.get();%0A        %7D catch (ExecutionException e) %7B%0A            throw e.getCause();%0A        %7D%0A    %7D%0A%0A%7D

add tests for MailServiceImpl