<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.springframework.kafka</groupId>
+ <artifactId>spring-kafka</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka-test</artifactId>
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.util.TestPropertyValues;
+import org.springframework.context.ApplicationContextInitializer;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.kafka.core.KafkaTemplate;
+import org.springframework.kafka.test.EmbeddedKafkaBroker;
import org.springframework.kafka.test.context.EmbeddedKafka;
+import org.springframework.test.context.DynamicPropertyRegistry;
+import org.springframework.test.context.DynamicPropertySource;
import static de.juplo.kafka.wordcount.splitter.ApplicationTests.TOPIC_IN;
import static de.juplo.kafka.wordcount.splitter.ApplicationTests.TOPIC_OUT;
@Autowired
SplitterStreamProcessor splitter;
+ @Autowired
+ EmbeddedKafkaBroker embeddedKafkaBroker;
+ @Autowired
+ KafkaTemplate<String, String> kafkaTemplate;
@Test
void contextLoads()
{
splitter.stop();
}
+
+ @Test
+ void split()
+ {
+ kafkaTemplate.send(TOPIC_IN, "Hello World!");
+ }
+
+
+ @DynamicPropertySource
+ static void registerProperties(DynamicPropertyRegistry registry)
+ {
+ registry.add("")
+ }
}