@@ -145,22 +145,18 @@ void testContainerPatternResubscribe() {
145145 container .addMessageListener (anotherListener , new PatternTopic (PATTERN ));
146146
147147 // Wait for async subscription tasks to setup
148- await ().atMost (Duration .ofMillis (600 )).untilAsserted (() -> {
149- // test no messages are sent just to patterns
150- assertThat (template .convertAndSend (CHANNEL , payload1 )).isEqualTo (1L );
151- assertThat (template .convertAndSend (ANOTHER_CHANNEL , payload2 )).isEqualTo (1L );
152- });
148+ // test no messages are sent just to patterns
149+ template .convertAndSend (CHANNEL , payload1 );
150+ template .convertAndSend (ANOTHER_CHANNEL , payload2 );
153151
154152 await ().atMost (Duration .ofSeconds (2 )).until (() -> bag2 .contains (payload1 ) && bag2 .contains (payload2 ));
155153
156154 // bind original listener on another channel
157155 container .addMessageListener (adapter , new ChannelTopic (ANOTHER_CHANNEL ));
158156
159157 // Wait for async subscription tasks to setup
160- await ().atMost (Duration .ofMillis (400 )).untilAsserted (() -> {
161- assertThat (template .convertAndSend (CHANNEL , payload1 )).isEqualTo (1L );
162- assertThat (template .convertAndSend (ANOTHER_CHANNEL , payload2 )).isEqualTo (2L );
163- });
158+ template .convertAndSend (CHANNEL , payload1 );
159+ template .convertAndSend (ANOTHER_CHANNEL , payload2 );
164160
165161 await ().atMost (Duration .ofSeconds (2 )).until (() -> bag .contains (payload2 ));
166162
@@ -183,17 +179,13 @@ void testContainerChannelResubscribe() {
183179 container .addMessageListener (adapter , new ChannelTopic (ANOTHER_CHANNEL ));
184180 container .removeMessageListener (null , new ChannelTopic (CHANNEL ));
185181
186- // timing: There's currently no other way to synchronize
187- // than to hope the subscribe/unsubscribe are executed within the time.
188- await ().atMost (Duration .ofMillis (400 )).untilAsserted (() -> {
189- // Listener removed from channel
190- assertThat (template .convertAndSend (CHANNEL , payload1 )).isEqualTo (0L );
191- assertThat (template .convertAndSend (CHANNEL , payload2 )).isEqualTo (0L );
182+ // Listener removed from channel
183+ template .convertAndSend (CHANNEL , payload1 );
184+ template .convertAndSend (CHANNEL , payload2 );
192185
193- // Listener receives messages on another channel
194- assertThat (template .convertAndSend (ANOTHER_CHANNEL , anotherPayload1 )).isEqualTo (1L );
195- assertThat (template .convertAndSend (ANOTHER_CHANNEL , anotherPayload2 )).isEqualTo (1L );
196- });
186+ // Listener receives messages on another channel
187+ template .convertAndSend (ANOTHER_CHANNEL , anotherPayload1 );
188+ template .convertAndSend (ANOTHER_CHANNEL , anotherPayload2 );
197189
198190 await ().atMost (Duration .ofSeconds (2 )).until (() -> bag .contains (anotherPayload1 ) && bag .contains (anotherPayload2 ));
199191 }
@@ -215,12 +207,8 @@ void testInitializeContainerWithMultipleTopicsIncludingPattern() {
215207 Arrays .asList (new Topic [] { new ChannelTopic (uniqueChannel ), new PatternTopic ("s*" ) }));
216208 container .start ();
217209
218- // timing: There's currently no other way to synchronize
219- // than to hope the subscribe/unsubscribe are executed within the time.
220- await ().atMost (Duration .ofMillis (250 )).untilAsserted (() -> {
221- assertThat (template .convertAndSend ("somechannel" , "HELLO" )).isEqualTo (1L );
222- assertThat (template .convertAndSend (uniqueChannel , "WORLD" )).isEqualTo (1L );
223- });
210+ assertThat (template .convertAndSend ("somechannel" , "HELLO" )).isEqualTo (1L );
211+ assertThat (template .convertAndSend (uniqueChannel , "WORLD" )).isEqualTo (1L );
224212
225213 await ().atMost (Duration .ofSeconds (2 )).until (() -> bag .contains ("HELLO" ) && bag .contains ("WORLD" ));
226214 }
0 commit comments