From: Kai Moritz Date: Fri, 15 Apr 2022 09:51:08 +0000 (+0200) Subject: Springify: GRÜN - `start()`/`stop()` werden im Test explizit aufgerufen X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=dac4556048bca9bfc505a0c348ec9a46313c8cf1;p=demos%2Fkafka%2Ftraining Springify: GRÜN - `start()`/`stop()` werden im Test explizit aufgerufen --- diff --git a/src/test/java/de/juplo/kafka/ApplicationTests.java b/src/test/java/de/juplo/kafka/ApplicationTests.java index cbf215e..35d2b2e 100644 --- a/src/test/java/de/juplo/kafka/ApplicationTests.java +++ b/src/test/java/de/juplo/kafka/ApplicationTests.java @@ -67,6 +67,8 @@ class ApplicationTests @Autowired ApplicationProperties properties; @Autowired + EndlessConsumer endlessConsumer; + @Autowired RecordHandler recordHandler; Map oldOffsets; @@ -224,8 +226,22 @@ class ApplicationTests newOffsets.put( new TopicPartition(record.topic(), record.partition()), record.offset()); + + endlessConsumer.start(); } + @AfterEach + public void deinit() + { + try + { + endlessConsumer.stop(); + } + catch (Exception e) + { + log.info("Exception while stopping the consumer: {}", e.toString()); + } + } public static class RecordHandler implements Consumer> {