counter: 1.2.11 - Refactored test-classes (DRY for test-config)
[demos/kafka/wordcount] / src / test / java / de / juplo / kafka / wordcount / counter / CounterApplicationIT.java
index fea89ab..e0f4672 100644 (file)
@@ -27,9 +27,9 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
-import java.util.stream.Collectors;
 
 import static de.juplo.kafka.wordcount.counter.CounterApplicationIT.*;
+import static de.juplo.kafka.wordcount.counter.TestData.convertToMap;
 import static org.awaitility.Awaitility.*;
 
 
@@ -97,14 +97,7 @@ public class CounterApplicationIT
                @Bean
                ProducerFactory<?, ?> producerFactory(Properties streamProcessorProperties)
                {
-                       Map<String, Object> propertyMap = streamProcessorProperties
-                                       .entrySet()
-                                       .stream()
-                                       .collect(
-                                                       Collectors.toMap(
-                                                                       entry -> (String)entry.getKey(),
-                                                                       entry -> entry.getValue()
-                                                       ));
+                       Map<String, Object> propertyMap = convertToMap(streamProcessorProperties);
 
                        propertyMap.put(
                                        ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
@@ -120,14 +113,7 @@ public class CounterApplicationIT
                ConcurrentKafkaListenerContainerFactory<?, ?> kafkaListenerContainerFactory(
                                Properties streamProcessorProperties)
                {
-                       Map<String, Object> propertyMap = streamProcessorProperties
-                                       .entrySet()
-                                       .stream()
-                                       .collect(
-                                                       Collectors.toMap(
-                                                                       entry -> (String)entry.getKey(),
-                                                                       entry -> entry.getValue()
-                                                       ));
+                       Map<String, Object> propertyMap = convertToMap(streamProcessorProperties);
 
                        propertyMap.put(
                                        ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG,