INT-1475 more polishing code and actually fixed an invalid test

This commit is contained in:
Oleg Zhurakousky
2010-09-23 21:57:35 -04:00
parent 325f8cff71
commit daa25d30e3
3 changed files with 6 additions and 6 deletions

View File

@@ -296,10 +296,9 @@ public abstract class AbstractMailReceiver extends IntegrationObjectSupport impl
*/
protected void setAdditionalFlags(Message message) throws MessagingException {}
/**
*
*/
@Override
protected void onInit() throws Exception {
super.onInit();
if (this.shouldDeleteMessages){
this.folderOpenMode = Folder.READ_WRITE;
}

View File

@@ -177,6 +177,7 @@ public class ImapMailReceiver extends AbstractMailReceiver {
@Override
protected void onInit() throws Exception {
super.onInit();
if (this.shouldMarkMessagesAsRead){
this.folderOpenMode = Folder.READ_WRITE;
}

View File

@@ -17,7 +17,6 @@ package org.springframework.integration.mail;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertTrue;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
@@ -165,8 +164,9 @@ public class ImapMailReceiverTests {
}
@Test
public void receiveAndDontMarkAsReadButDelete() throws Exception{
AbstractMailReceiver receiver = new Pop3MailReceiver();
((Pop3MailReceiver)receiver).setShouldDeleteMessages(true);
AbstractMailReceiver receiver = new ImapMailReceiver();
((ImapMailReceiver)receiver).setShouldDeleteMessages(true);
((ImapMailReceiver)receiver).setShouldMarkMessagesAsRead(false);
receiver = spy(receiver);
receiver.afterPropertiesSet();
Message msg1 = mock(MimeMessage.class);