|
21 | 21 | import org.testcontainers.junit.jupiter.Testcontainers; |
22 | 22 |
|
23 | 23 | import java.time.Duration; |
24 | | -import java.util.HashSet; |
25 | | -import java.util.List; |
26 | | -import java.util.Map; |
27 | | -import java.util.Set; |
| 24 | +import java.util.*; |
28 | 25 | import java.util.concurrent.atomic.AtomicBoolean; |
| 26 | +import java.util.stream.Collectors; |
29 | 27 |
|
30 | 28 | import static org.awaitility.Awaitility.await; |
31 | 29 |
|
@@ -84,13 +82,15 @@ void testConsumerRegistration1() throws Exception { |
84 | 82 | @Test |
85 | 83 | void testConsumerRegistration2() { |
86 | 84 | final Class<TestConsumers> clazz = TestConsumers.class; |
87 | | - final String descriptor = clazz.getName() + clazz.getMethods()[0].getName(); |
88 | | - final ConsumerHolder consumerHolder = consumerCollector.getConsumer(descriptor).orElse(null); |
89 | | - |
90 | | - Assertions.assertNotNull(consumerHolder); |
91 | | - Assertions.assertEquals("topic-one", consumerHolder.getAnnotation().topic()); |
92 | | - Assertions.assertEquals(TestConsumers.class, consumerHolder.getBean().getClass()); |
93 | | - Assertions.assertEquals("topicOneListener", consumerHolder.getHandler().getName()); |
| 85 | + final List<ConsumerHolder> consumerHolders = Arrays.stream(clazz.getMethods()) |
| 86 | + .map($ -> consumerCollector.getConsumer(clazz.getName() + $.getName()).orElse(null)) |
| 87 | + .collect(Collectors.toList()); |
| 88 | + |
| 89 | + Assertions.assertNotNull(consumerHolders); |
| 90 | + Assertions.assertTrue(consumerHolders.stream().anyMatch($ -> $.getAnnotation().topic().equals("topic-one"))); |
| 91 | + Assertions.assertTrue(consumerHolders.stream().anyMatch($ -> $.getAnnotation().topic().equals("topic-for-error"))); |
| 92 | + Assertions.assertTrue(consumerHolders.stream().anyMatch($ -> $.getBean().getClass().equals(TestConsumers.class))); |
| 93 | + Assertions.assertTrue(consumerHolders.stream().anyMatch($ -> $.getHandler().getName().equals("topicOneListener"))); |
94 | 94 | } |
95 | 95 |
|
96 | 96 | @Test |
|
0 commit comments