11/*
2- * Copyright 2002-2024 the original author or authors.
2+ * Copyright 2002-2025 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
111111 * @author Alexander Pinske
112112 * @author Dominik Simmen
113113 * @author Filip Hrisafov
114+ * @author Ma Jiandong
114115 */
115116@ SpringJUnitConfig
116117@ ContextConfiguration (
@@ -167,7 +168,7 @@ void stopImapServer() {
167168 }
168169
169170 @ Test
170- public void testIdleWithServerCustomSearch () throws Exception {
171+ void idleWithServerCustomSearch () throws Exception {
171172 ImapMailReceiver receiver =
172173 new ImapMailReceiver ("imap://user:pw@localhost:" + imapIdleServer .getImap ().getPort () + "/INBOX" );
173174 receiver .setSearchTermStrategy ((supportedFlags , folder ) -> {
@@ -183,15 +184,15 @@ public void testIdleWithServerCustomSearch() throws Exception {
183184 }
184185
185186 @ Test
186- public void testIdleWithServerDefaultSearch () throws Exception {
187+ void idleWithServerDefaultSearch () throws Exception {
187188 ImapMailReceiver receiver =
188189 new ImapMailReceiver ("imap://user:pw@localhost:" + imapIdleServer .getImap ().getPort () + "/INBOX" );
189190 testIdleWithServerGuts (receiver , false );
190191 assertThat (imapSearches .searches .get (0 )).contains ("testSIUserFlag" );
191192 }
192193
193194 @ Test
194- public void testIdleWithMessageMapping () throws Exception {
195+ void idleWithMessageMapping () throws Exception {
195196 ImapMailReceiver receiver =
196197 new ImapMailReceiver ("imap://user:pw@localhost:" + imapIdleServer .getImap ().getPort () + "/INBOX" );
197198 receiver .setHeaderMapper (new DefaultMailHeaderMapper ());
@@ -200,7 +201,7 @@ public void testIdleWithMessageMapping() throws Exception {
200201
201202 @ Test
202203 @ Disabled
203- public void testIdleWithServerDefaultSearchSimple () throws Exception {
204+ void idleWithServerDefaultSearchSimple () throws Exception {
204205 ImapMailReceiver receiver =
205206 new ImapMailReceiver ("imap://user:pw@localhost:" + imapIdleServer .getImap ().getPort () + "/INBOX" );
206207 receiver .setSimpleContent (true );
@@ -209,7 +210,7 @@ public void testIdleWithServerDefaultSearchSimple() throws Exception {
209210 }
210211
211212 @ Test
212- public void testIdleWithMessageMappingSimple () throws Exception {
213+ void idleWithMessageMappingSimple () throws Exception {
213214 ImapMailReceiver receiver =
214215 new ImapMailReceiver ("imap://user:pw@localhost:" + imapIdleServer .getImap ().getPort () + "/INBOX" );
215216 receiver .setSimpleContent (true );
@@ -289,7 +290,7 @@ public void testIdleWithServerGuts(ImapMailReceiver receiver, boolean mapped, bo
289290 }
290291
291292 @ Test
292- public void receiveAndMarkAsReadDontDelete () throws Exception {
293+ void receiveAndMarkAsReadDontDelete () throws Exception {
293294 user .deliver (GreenMailUtil .createTextEmail ("user" , "sender" , "subject" , "body" ,
294295 imapIdleServer .getImap ().getServerSetup ()));
295296 AbstractMailReceiver receiver = new ImapMailReceiver ();
@@ -342,7 +343,7 @@ private AbstractMailReceiver receiveAndMarkAsReadDontDeleteGuts(AbstractMailRece
342343 }
343344
344345 @ Test
345- public void receiveAndMarkAsReadDontDeletePassingFilter () throws Exception {
346+ void receiveAndMarkAsReadDontDeletePassingFilter () throws Exception {
346347 AbstractMailReceiver receiver = new ImapMailReceiver ();
347348 Message msg1 = GreenMailUtil .newMimeMessage ("test1" );
348349 Message msg2 = GreenMailUtil .newMimeMessage ("test2" );
@@ -355,7 +356,7 @@ public void receiveAndMarkAsReadDontDeletePassingFilter() throws Exception {
355356 }
356357
357358 @ Test
358- public void receiveAndMarkAsReadDontDeleteFiltered () throws Exception {
359+ void receiveAndMarkAsReadDontDeleteFiltered () throws Exception {
359360 AbstractMailReceiver receiver = new ImapMailReceiver ();
360361 Message msg1 = GreenMailUtil .newMimeMessage ("test1" );
361362 Message msg2 = spy (GreenMailUtil .newMimeMessage ("test2" ));
@@ -370,7 +371,7 @@ public void receiveAndMarkAsReadDontDeleteFiltered() throws Exception {
370371 }
371372
372373 @ Test
373- public void receiveAndDebugIsDisabledNotLogFiltered () throws Exception {
374+ void receiveAndDebugIsDisabledNotLogFiltered () throws Exception {
374375 AbstractMailReceiver receiver = new ImapMailReceiver ();
375376
376377 LogAccessor logger = spy (TestUtils .getPropertyValue (receiver , "logger" , LogAccessor .class ));
@@ -391,7 +392,7 @@ public void receiveAndDebugIsDisabledNotLogFiltered() throws Exception {
391392 }
392393
393394 @ Test
394- public void receiveExpungedAndNotExpungedLogFiltered () throws Exception {
395+ void receiveExpungedAndNotExpungedLogFiltered () throws Exception {
395396 AbstractMailReceiver receiver = new ImapMailReceiver ();
396397
397398 LogAccessor logger = spy (TestUtils .getPropertyValue (receiver , "logger" , LogAccessor .class ));
@@ -414,7 +415,7 @@ public void receiveExpungedAndNotExpungedLogFiltered() throws Exception {
414415 }
415416
416417 @ Test
417- public void receiveMarkAsReadAndDelete () throws Exception {
418+ void receiveMarkAsReadAndDelete () throws Exception {
418419 AbstractMailReceiver receiver = new ImapMailReceiver ();
419420 ((ImapMailReceiver ) receiver ).setShouldMarkMessagesAsRead (true );
420421 receiver .setShouldDeleteMessages (true );
@@ -453,7 +454,7 @@ public void receiveMarkAsReadAndDelete() throws Exception {
453454 }
454455
455456 @ Test
456- public void receiveAndDontMarkAsRead () throws Exception {
457+ void receiveAndDontMarkAsRead () throws Exception {
457458 AbstractMailReceiver receiver = new ImapMailReceiver ();
458459 ((ImapMailReceiver ) receiver ).setShouldMarkMessagesAsRead (false );
459460 receiver = spy (receiver );
@@ -482,7 +483,7 @@ public void receiveAndDontMarkAsRead() throws Exception {
482483 }
483484
484485 @ Test
485- public void receiveAndDontMarkAsReadButDelete () throws Exception {
486+ void receiveAndDontMarkAsReadButDelete () throws Exception {
486487 AbstractMailReceiver receiver = new ImapMailReceiver ();
487488 receiver .setShouldDeleteMessages (true );
488489 ((ImapMailReceiver ) receiver ).setShouldMarkMessagesAsRead (false );
@@ -522,7 +523,7 @@ public void receiveAndDontMarkAsReadButDelete() throws Exception {
522523 }
523524
524525 @ Test
525- public void receiveAndIgnoreMarkAsReadDontDelete () throws Exception {
526+ void receiveAndIgnoreMarkAsReadDontDelete () throws Exception {
526527 AbstractMailReceiver receiver = new ImapMailReceiver ();
527528 receiver = spy (receiver );
528529 receiver .setBeanFactory (mock (BeanFactory .class ));
@@ -557,7 +558,7 @@ public void receiveAndIgnoreMarkAsReadDontDelete() throws Exception {
557558 }
558559
559560 @ Test
560- public void testMessageHistory () throws Exception {
561+ void messageHistory () throws Exception {
561562 ImapIdleChannelAdapter adapter = this .context .getBean ("simpleAdapter" , ImapIdleChannelAdapter .class );
562563 adapter .setReconnectDelay (10 );
563564
@@ -600,7 +601,7 @@ public void testMessageHistory() throws Exception {
600601 }
601602
602603 @ Test
603- public void testIdleChannelAdapterException () throws Exception {
604+ void idleChannelAdapterException () throws Exception {
604605 ImapIdleChannelAdapter adapter = this .context .getBean ("simpleAdapter" , ImapIdleChannelAdapter .class );
605606
606607 //ImapMailReceiver receiver = (ImapMailReceiver) TestUtils.getPropertyValue(adapter, "mailReceiver");
@@ -653,7 +654,7 @@ protected Object handleRequestMessage(org.springframework.messaging.Message<?> r
653654
654655 @ SuppressWarnings ("resource" )
655656 @ Test
656- public void testNoInitialIdleDelayWhenRecentNotSupported () throws Exception {
657+ void noInitialIdleDelayWhenRecentNotSupported () throws Exception {
657658 ImapIdleChannelAdapter adapter = this .context .getBean ("simpleAdapter" , ImapIdleChannelAdapter .class );
658659
659660 QueueChannel channel = new QueueChannel ();
@@ -721,7 +722,7 @@ public void testNoInitialIdleDelayWhenRecentNotSupported() throws Exception {
721722 }
722723
723724 @ Test
724- public void testInitialIdleDelayWhenRecentIsSupported () throws Exception {
725+ void initialIdleDelayWhenRecentIsSupported () throws Exception {
725726 ImapIdleChannelAdapter adapter = this .context .getBean ("simpleAdapter" , ImapIdleChannelAdapter .class );
726727
727728 QueueChannel channel = new QueueChannel ();
@@ -776,7 +777,7 @@ public void testInitialIdleDelayWhenRecentIsSupported() throws Exception {
776777 }
777778
778779 @ Test
779- public void testConnectionException () throws Exception {
780+ void connectionException () throws Exception {
780781 ImapMailReceiver mailReceiver = new ImapMailReceiver ("imap:foo" );
781782 ImapIdleChannelAdapter adapter = new ImapIdleChannelAdapter (mailReceiver );
782783 final AtomicReference <Object > theEvent = new AtomicReference <>();
@@ -795,8 +796,9 @@ public void testConnectionException() throws Exception {
795796 adapter .stop ();
796797 }
797798
798- @ Test // see INT-1801
799- public void testImapLifecycleForRaceCondition () throws Exception {
799+ // see INT-1801
800+ @ Test
801+ void imapLifecycleForRaceCondition () throws Exception {
800802 final AtomicInteger failed = new AtomicInteger (0 );
801803 for (int i = 0 ; i < 100 ; i ++) {
802804 final ImapMailReceiver receiver = new ImapMailReceiver ("imap://foo" );
@@ -838,7 +840,7 @@ public void testImapLifecycleForRaceCondition() throws Exception {
838840 }
839841
840842 @ Test
841- public void testAttachments () throws Exception {
843+ void attachments () throws Exception {
842844 final ImapMailReceiver receiver = new ImapMailReceiver ("imap://foo" );
843845 Folder folder = testAttachmentsGuts (receiver );
844846 Message [] messages = (Message []) receiver .receive ();
@@ -850,7 +852,7 @@ public void testAttachments() throws Exception {
850852 }
851853
852854 @ Test
853- public void testAttachmentsWithMappingMultiAsBytes () throws Exception {
855+ void attachmentsWithMappingMultiAsBytes () throws Exception {
854856 final ImapMailReceiver receiver = new ImapMailReceiver ("imap://foo" );
855857 receiver .setHeaderMapper (new DefaultMailHeaderMapper ());
856858 testAttachmentsGuts (receiver );
@@ -865,7 +867,7 @@ public void testAttachmentsWithMappingMultiAsBytes() throws Exception {
865867 }
866868
867869 @ Test
868- public void testAttachmentsWithMapping () throws Exception {
870+ void attachmentsWithMapping () throws Exception {
869871 final ImapMailReceiver receiver = new ImapMailReceiver ("imap://foo" );
870872 receiver .setHeaderMapper (new DefaultMailHeaderMapper ());
871873 receiver .setEmbeddedPartsAsBytes (false );
@@ -897,7 +899,7 @@ private Folder testAttachmentsGuts(final ImapMailReceiver receiver) throws Messa
897899 }
898900
899901 @ Test
900- public void testNullMessages () throws Exception {
902+ void nullMessages () throws Exception {
901903 Message message1 = GreenMailUtil .newMimeMessage ("test1" );
902904 Message message2 = GreenMailUtil .newMimeMessage ("test2" );
903905 final Message [] messages1 = new Message [] {null , null , message1 };
@@ -944,7 +946,7 @@ public Message[] receive() throws MessagingException {
944946 }
945947
946948 @ Test
947- public void testIdleReconnects () throws Exception {
949+ void idleReconnects () throws Exception {
948950 ImapMailReceiver receiver = spy (new ImapMailReceiver ("imap:foo" ));
949951 receiver .setBeanFactory (mock (BeanFactory .class ));
950952 receiver .afterPropertiesSet ();
@@ -989,7 +991,7 @@ private void setUpScheduler(ImapMailReceiver mailReceiver, ThreadPoolTaskSchedul
989991 }
990992
991993 @ Test
992- public void receiveAndMarkAsReadDontDeleteWithThrowingWhenCopying () throws Exception {
994+ void receiveAndMarkAsReadDontDeleteWithThrowingWhenCopying () throws Exception {
993995 AbstractMailReceiver receiver = new ImapMailReceiver ();
994996 MimeMessage msg1 = spy (GreenMailUtil .newMimeMessage ("test1" ));
995997 MimeMessage greenMailMsg2 = GreenMailUtil .newMimeMessage ("test2" );
0 commit comments