Testing Asynchronous Code with Awaitility (@Async, Kafka Listeners, Schedulers)
Thread.sleep in a test is a guess about timing, not a wait. This post replaces it with Awaitility's await() across a void @Async method, a real in-process @EmbeddedKafka listener, and a @Scheduled job -- plus the pom.xml trap where Spring Boot 4.1.1 split Kafka's autoconfiguration into its own module, leaving @KafkaListener silently unwired.