checkstyle WhiteAround
WhiteAroundCheck script
This commit is contained in:
@@ -182,7 +182,7 @@ public class ImapMailReceiverTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void receiveAndMarkAsReadDontDelete() throws Exception{
|
||||
public void receiveAndMarkAsReadDontDelete() throws Exception {
|
||||
AbstractMailReceiver receiver = new ImapMailReceiver();
|
||||
Message msg1 = mock(MimeMessage.class);
|
||||
Message msg2 = mock(MimeMessage.class);
|
||||
@@ -194,7 +194,7 @@ public class ImapMailReceiverTests {
|
||||
|
||||
private AbstractMailReceiver receiveAndMarkAsReadDontDeleteGuts(AbstractMailReceiver receiver, Message msg1,
|
||||
Message msg2) throws NoSuchFieldException, IllegalAccessException, MessagingException {
|
||||
((ImapMailReceiver)receiver).setShouldMarkMessagesAsRead(true);
|
||||
((ImapMailReceiver) receiver).setShouldMarkMessagesAsRead(true);
|
||||
receiver = spy(receiver);
|
||||
receiver.setBeanFactory(mock(BeanFactory.class));
|
||||
receiver.afterPropertiesSet();
|
||||
@@ -211,7 +211,7 @@ public class ImapMailReceiverTests {
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
DirectFieldAccessor accessor = new DirectFieldAccessor(invocation.getMock());
|
||||
int folderOpenMode = (Integer) accessor.getPropertyValue("folderOpenMode");
|
||||
if (folderOpenMode != Folder.READ_WRITE){
|
||||
if (folderOpenMode != Folder.READ_WRITE) {
|
||||
throw new IllegalArgumentException("Folder had to be open in READ_WRITE mode");
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ public class ImapMailReceiverTests {
|
||||
}
|
||||
|
||||
@Test // INT-2991 Flag.SEEN was set twice when a filter is used
|
||||
public void receiveAndMarkAsReadDontDeletePassingFilter() throws Exception{
|
||||
public void receiveAndMarkAsReadDontDeletePassingFilter() throws Exception {
|
||||
AbstractMailReceiver receiver = new ImapMailReceiver();
|
||||
Message msg1 = mock(MimeMessage.class);
|
||||
Message msg2 = mock(MimeMessage.class);
|
||||
@@ -250,7 +250,7 @@ public class ImapMailReceiverTests {
|
||||
}
|
||||
|
||||
@Test // INT-2991 filtered messages were marked SEEN
|
||||
public void receiveAndMarkAsReadDontDeleteFiltered() throws Exception{
|
||||
public void receiveAndMarkAsReadDontDeleteFiltered() throws Exception {
|
||||
AbstractMailReceiver receiver = new ImapMailReceiver();
|
||||
Message msg1 = mock(MimeMessage.class);
|
||||
Message msg2 = mock(MimeMessage.class);
|
||||
@@ -266,9 +266,9 @@ public class ImapMailReceiverTests {
|
||||
|
||||
|
||||
@Test
|
||||
public void receiveMarkAsReadAndDelete() throws Exception{
|
||||
public void receiveMarkAsReadAndDelete() throws Exception {
|
||||
AbstractMailReceiver receiver = new ImapMailReceiver();
|
||||
((ImapMailReceiver)receiver).setShouldMarkMessagesAsRead(true);
|
||||
((ImapMailReceiver) receiver).setShouldMarkMessagesAsRead(true);
|
||||
receiver.setShouldDeleteMessages(true);
|
||||
receiver = spy(receiver);
|
||||
receiver.setBeanFactory(mock(BeanFactory.class));
|
||||
@@ -288,7 +288,7 @@ public class ImapMailReceiverTests {
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
DirectFieldAccessor accessor = new DirectFieldAccessor(invocation.getMock());
|
||||
int folderOpenMode = (Integer) accessor.getPropertyValue("folderOpenMode");
|
||||
if (folderOpenMode != Folder.READ_WRITE){
|
||||
if (folderOpenMode != Folder.READ_WRITE) {
|
||||
throw new IllegalArgumentException("Folder had to be open in READ_WRITE mode");
|
||||
}
|
||||
return null;
|
||||
@@ -315,9 +315,9 @@ public class ImapMailReceiverTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void receiveAndDontMarkAsRead() throws Exception{
|
||||
public void receiveAndDontMarkAsRead() throws Exception {
|
||||
AbstractMailReceiver receiver = new ImapMailReceiver();
|
||||
((ImapMailReceiver)receiver).setShouldMarkMessagesAsRead(false);
|
||||
((ImapMailReceiver) receiver).setShouldMarkMessagesAsRead(false);
|
||||
receiver = spy(receiver);
|
||||
receiver.setBeanFactory(mock(BeanFactory.class));
|
||||
receiver.afterPropertiesSet();
|
||||
@@ -358,10 +358,10 @@ public class ImapMailReceiverTests {
|
||||
verify(msg2, times(0)).setFlag(Flag.SEEN, true);
|
||||
}
|
||||
@Test
|
||||
public void receiveAndDontMarkAsReadButDelete() throws Exception{
|
||||
public void receiveAndDontMarkAsReadButDelete() throws Exception {
|
||||
AbstractMailReceiver receiver = new ImapMailReceiver();
|
||||
((ImapMailReceiver)receiver).setShouldDeleteMessages(true);
|
||||
((ImapMailReceiver)receiver).setShouldMarkMessagesAsRead(false);
|
||||
((ImapMailReceiver) receiver).setShouldDeleteMessages(true);
|
||||
((ImapMailReceiver) receiver).setShouldMarkMessagesAsRead(false);
|
||||
receiver = spy(receiver);
|
||||
receiver.setBeanFactory(mock(BeanFactory.class));
|
||||
receiver.afterPropertiesSet();
|
||||
@@ -380,7 +380,7 @@ public class ImapMailReceiverTests {
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
DirectFieldAccessor accessor = new DirectFieldAccessor(invocation.getMock());
|
||||
int folderOpenMode = (Integer) accessor.getPropertyValue("folderOpenMode");
|
||||
if (folderOpenMode != Folder.READ_WRITE){
|
||||
if (folderOpenMode != Folder.READ_WRITE) {
|
||||
throw new IllegalArgumentException("Folder had to be open in READ_WRITE mode");
|
||||
}
|
||||
return null;
|
||||
@@ -408,7 +408,7 @@ public class ImapMailReceiverTests {
|
||||
verify(msg2, times(1)).setFlag(Flag.DELETED, true);
|
||||
}
|
||||
@Test
|
||||
public void receiveAndIgnoreMarkAsReadDontDelete() throws Exception{
|
||||
public void receiveAndIgnoreMarkAsReadDontDelete() throws Exception {
|
||||
AbstractMailReceiver receiver = new ImapMailReceiver();
|
||||
receiver = spy(receiver);
|
||||
receiver.setBeanFactory(mock(BeanFactory.class));
|
||||
@@ -428,7 +428,7 @@ public class ImapMailReceiverTests {
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
DirectFieldAccessor accessor = new DirectFieldAccessor(invocation.getMock());
|
||||
int folderOpenMode = (Integer) accessor.getPropertyValue("folderOpenMode");
|
||||
if (folderOpenMode != Folder.READ_WRITE){
|
||||
if (folderOpenMode != Folder.READ_WRITE) {
|
||||
throw new IllegalArgumentException("Folder had to be open in READ_WRITE mode");
|
||||
}
|
||||
return null;
|
||||
@@ -455,7 +455,7 @@ public class ImapMailReceiverTests {
|
||||
}
|
||||
@Test
|
||||
@Ignore
|
||||
public void testMessageHistory() throws Exception{
|
||||
public void testMessageHistory() throws Exception {
|
||||
ConfigurableApplicationContext context =
|
||||
new ClassPathXmlApplicationContext("ImapIdleChannelAdapterParserTests-context.xml", ImapIdleChannelAdapterParserTests.class);
|
||||
ImapIdleChannelAdapter adapter = context.getBean("simpleAdapter", ImapIdleChannelAdapter.class);
|
||||
@@ -512,7 +512,7 @@ public class ImapMailReceiverTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIdleChannelAdapterException() throws Exception{
|
||||
public void testIdleChannelAdapterException() throws Exception {
|
||||
ConfigurableApplicationContext context =
|
||||
new ClassPathXmlApplicationContext("ImapIdleChannelAdapterParserTests-context.xml", ImapIdleChannelAdapterParserTests.class);
|
||||
ImapIdleChannelAdapter adapter = context.getBean("simpleAdapter", ImapIdleChannelAdapter.class);
|
||||
@@ -588,7 +588,7 @@ public class ImapMailReceiverTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoInitialIdleDelayWhenRecentNotSupported() throws Exception{
|
||||
public void testNoInitialIdleDelayWhenRecentNotSupported() throws Exception {
|
||||
ConfigurableApplicationContext context =
|
||||
new ClassPathXmlApplicationContext("ImapIdleChannelAdapterParserTests-context.xml", ImapIdleChannelAdapterParserTests.class);
|
||||
ImapIdleChannelAdapter adapter = context.getBean("simpleAdapter", ImapIdleChannelAdapter.class);
|
||||
@@ -678,7 +678,7 @@ public class ImapMailReceiverTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInitialIdleDelayWhenRecentIsSupported() throws Exception{
|
||||
public void testInitialIdleDelayWhenRecentIsSupported() throws Exception {
|
||||
ConfigurableApplicationContext context =
|
||||
new ClassPathXmlApplicationContext("ImapIdleChannelAdapterParserTests-context.xml", ImapIdleChannelAdapterParserTests.class);
|
||||
ImapIdleChannelAdapter adapter = context.getBean("simpleAdapter", ImapIdleChannelAdapter.class);
|
||||
@@ -785,7 +785,7 @@ public class ImapMailReceiverTests {
|
||||
}
|
||||
|
||||
@Test // see INT-1801
|
||||
public void testImapLifecycleForRaceCondition() throws Exception{
|
||||
public void testImapLifecycleForRaceCondition() throws Exception {
|
||||
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
final ImapMailReceiver receiver = new ImapMailReceiver("imap://foo");
|
||||
@@ -805,12 +805,12 @@ public class ImapMailReceiverTests {
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run(){
|
||||
public void run() {
|
||||
try {
|
||||
receiver.receive();
|
||||
}
|
||||
catch (javax.mail.MessagingException e) {
|
||||
if (e.getCause() instanceof NullPointerException){
|
||||
if (e.getCause() instanceof NullPointerException) {
|
||||
e.printStackTrace();
|
||||
failed.getAndIncrement();
|
||||
}
|
||||
@@ -821,7 +821,7 @@ public class ImapMailReceiverTests {
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run(){
|
||||
public void run() {
|
||||
try {
|
||||
receiver.destroy();
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public class ImapMailSearchTermsTests {
|
||||
NotTerm notTerm = (NotTerm) searchTerms;
|
||||
Flags siFlags = new Flags();
|
||||
siFlags.add(userFlag);
|
||||
assertEquals(siFlags, ((FlagTerm)notTerm.getTerm()).getFlags());
|
||||
assertEquals(siFlags, ((FlagTerm) notTerm.getTerm()).getFlags());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -105,11 +105,11 @@ public class ImapMailSearchTermsTests {
|
||||
SearchTerm[] terms = andTerm.getTerms();
|
||||
assertEquals(2, terms.length);
|
||||
NotTerm notTerm = (NotTerm) terms[0];
|
||||
assertTrue(((FlagTerm)notTerm.getTerm()).getFlags().contains(Flag.ANSWERED));
|
||||
assertTrue(((FlagTerm) notTerm.getTerm()).getFlags().contains(Flag.ANSWERED));
|
||||
notTerm = (NotTerm) terms[1];
|
||||
Flags siFlags = new Flags();
|
||||
siFlags.add(AbstractMailReceiver.DEFAULT_SI_USER_FLAG);
|
||||
assertTrue(((FlagTerm)notTerm.getTerm()).getFlags().contains(siFlags));
|
||||
assertTrue(((FlagTerm) notTerm.getTerm()).getFlags().contains(siFlags));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -65,7 +65,7 @@ public class MailReceiverTests {
|
||||
Folder folder = mock(Folder.class);
|
||||
when(folder.exists()).thenReturn(true);
|
||||
when(folder.isOpen()).thenReturn(false);
|
||||
doReturn(folder).when(store).getFolder((URLName)null);
|
||||
doReturn(folder).when(store).getFolder((URLName) null);
|
||||
doAnswer(new DoesNothing()).when(store).connect();
|
||||
receiver.openFolder();
|
||||
receiver.openFolder();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -79,7 +79,7 @@ public class MailTestsHelper {
|
||||
|
||||
public static MailReceiverContext setupContextHolder(AbstractMailReceiver receiver) {
|
||||
@SuppressWarnings("unchecked")
|
||||
ThreadLocal<MailReceiverContext> contextHolder = TestUtils.getPropertyValue(receiver, "contextHolder",ThreadLocal.class);
|
||||
ThreadLocal<MailReceiverContext> contextHolder = TestUtils.getPropertyValue(receiver, "contextHolder", ThreadLocal.class);
|
||||
Folder folder = mock(Folder.class);
|
||||
MailReceiverContext context = new MailReceiverContext(folder);
|
||||
contextHolder.set(context);
|
||||
|
||||
@@ -321,7 +321,7 @@ public class PoorMansMailServer {
|
||||
else if (line.contains("NOOP")) {
|
||||
write(tag + "OK NOOP completed");
|
||||
}
|
||||
else if(line.endsWith("STORE 1 +FLAGS (testSIUserFlag)")) {
|
||||
else if (line.endsWith("STORE 1 +FLAGS (testSIUserFlag)")) {
|
||||
write(tag + "OK STORE completed");
|
||||
assertions.add("storeUserFlag");
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -45,9 +45,9 @@ import org.springframework.beans.factory.BeanFactory;
|
||||
*/
|
||||
public class Pop3MailReceiverTests {
|
||||
@Test
|
||||
public void receiveAndDelete() throws Exception{
|
||||
public void receiveAndDelete() throws Exception {
|
||||
AbstractMailReceiver receiver = new Pop3MailReceiver();
|
||||
((Pop3MailReceiver)receiver).setShouldDeleteMessages(true);
|
||||
((Pop3MailReceiver) receiver).setShouldDeleteMessages(true);
|
||||
receiver = spy(receiver);
|
||||
receiver.setBeanFactory(mock(BeanFactory.class));
|
||||
receiver.afterPropertiesSet();
|
||||
@@ -65,7 +65,7 @@ public class Pop3MailReceiverTests {
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
DirectFieldAccessor accessor = new DirectFieldAccessor(invocation.getMock());
|
||||
int folderOpenMode = (Integer) accessor.getPropertyValue("folderOpenMode");
|
||||
if (folderOpenMode != Folder.READ_WRITE){
|
||||
if (folderOpenMode != Folder.READ_WRITE) {
|
||||
throw new IllegalArgumentException("Folder had to be open in READ_WRITE mode");
|
||||
}
|
||||
return null;
|
||||
@@ -89,9 +89,9 @@ public class Pop3MailReceiverTests {
|
||||
verify(msg2, times(1)).setFlag(Flag.DELETED, true);
|
||||
}
|
||||
@Test
|
||||
public void receiveAndDontDelete() throws Exception{
|
||||
public void receiveAndDontDelete() throws Exception {
|
||||
AbstractMailReceiver receiver = new Pop3MailReceiver();
|
||||
((Pop3MailReceiver)receiver).setShouldDeleteMessages(false);
|
||||
((Pop3MailReceiver) receiver).setShouldDeleteMessages(false);
|
||||
receiver = spy(receiver);
|
||||
receiver.setBeanFactory(mock(BeanFactory.class));
|
||||
receiver.afterPropertiesSet();
|
||||
@@ -128,7 +128,7 @@ public class Pop3MailReceiverTests {
|
||||
verify(msg2, times(0)).setFlag(Flag.DELETED, true);
|
||||
}
|
||||
@Test
|
||||
public void receiveAndDontSetDeleteWithUrl() throws Exception{
|
||||
public void receiveAndDontSetDeleteWithUrl() throws Exception {
|
||||
AbstractMailReceiver receiver = new Pop3MailReceiver("pop3://some.host");
|
||||
receiver = spy(receiver);
|
||||
receiver.setBeanFactory(mock(BeanFactory.class));
|
||||
@@ -166,7 +166,7 @@ public class Pop3MailReceiverTests {
|
||||
verify(msg2, times(0)).setFlag(Flag.DELETED, true);
|
||||
}
|
||||
@Test
|
||||
public void receiveAndDontSetDeleteWithoutUrl() throws Exception{
|
||||
public void receiveAndDontSetDeleteWithoutUrl() throws Exception {
|
||||
AbstractMailReceiver receiver = new Pop3MailReceiver();
|
||||
receiver = spy(receiver);
|
||||
receiver.setBeanFactory(mock(BeanFactory.class));
|
||||
|
||||
@@ -28,15 +28,15 @@ public class FailedMailConfigurationTests {
|
||||
/**
|
||||
* validates that if 'should-delete-messages' is not set the context fails
|
||||
*/
|
||||
@Test(expected=XmlBeanDefinitionStoreException.class)
|
||||
public void testImapIdleWithNoDeleteMessageAttribute(){
|
||||
@Test(expected = XmlBeanDefinitionStoreException.class)
|
||||
public void testImapIdleWithNoDeleteMessageAttribute() {
|
||||
new ClassPathXmlApplicationContext("failed-imap-config.xml", this.getClass());
|
||||
}
|
||||
/**
|
||||
* validates that if 'should-delete-messages' is not set the context fails
|
||||
*/
|
||||
@Test(expected=XmlBeanDefinitionStoreException.class)
|
||||
public void testAdapterWithNoDeleteMessageAttribute(){
|
||||
@Test(expected = XmlBeanDefinitionStoreException.class)
|
||||
public void testAdapterWithNoDeleteMessageAttribute() {
|
||||
new ClassPathXmlApplicationContext("failed-adapter-config.xml", this.getClass());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -283,7 +283,7 @@ public class InboundChannelAdapterParserTests {
|
||||
.close();
|
||||
fail("expected a parser error");
|
||||
}
|
||||
catch(BeanDefinitionStoreException e) {
|
||||
catch (BeanDefinitionStoreException e) {
|
||||
assertEquals(SAXParseException.class, e.getCause().getClass());
|
||||
}
|
||||
}
|
||||
@@ -310,7 +310,7 @@ public class InboundChannelAdapterParserTests {
|
||||
.close();
|
||||
fail("expected a parser error");
|
||||
}
|
||||
catch(BeanCreationException e) {
|
||||
catch (BeanCreationException e) {
|
||||
assertTrue(e.getMessage().contains("searchTermStrategy is only allowed with imap"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class MessageWithContentTypeTests {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testSendEmail() throws Exception{
|
||||
public void testSendEmail() throws Exception {
|
||||
ApplicationContext ac = new ClassPathXmlApplicationContext("MessageWithContentTypeTests-context.xml", this.getClass());
|
||||
MessageChannel inputChannel = ac.getBean("inputChannel", MessageChannel.class);
|
||||
StringWriter writer = new StringWriter();
|
||||
@@ -65,7 +65,7 @@ public class MessageWithContentTypeTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMessageConversionWithHtmlAndContentType() throws Exception{
|
||||
public void testMessageConversionWithHtmlAndContentType() throws Exception {
|
||||
JavaMailSender sender = mock(JavaMailSender.class);
|
||||
MailSendingMessageHandler handler = new MailSendingMessageHandler(sender);
|
||||
StringWriter writer = new StringWriter();
|
||||
@@ -93,7 +93,7 @@ public class MessageWithContentTypeTests {
|
||||
verify(sender, times(1)).send(Mockito.any(MimeMessage.class));
|
||||
}
|
||||
|
||||
private static class TestMimeMessage extends MimeMessage{
|
||||
private static class TestMimeMessage extends MimeMessage {
|
||||
TestMimeMessage() {
|
||||
super(Session.getDefaultInstance(new Properties()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user