private static String typeMappingsConfig()
{
- return typeMappings()
- .entrySet()
- .stream()
- .map(entry -> entry.getKey() + ":" + entry.getValue().getName())
- .collect(Collectors.joining(","));
+ return typeMappingsConfig(Word.class, WordCounter.class);
}
- private static Map<String, Class> typeMappings()
+ public static String typeMappingsConfig(Class wordClass, Class wordCounterClass)
{
return Map.of(
- "word", Word.class,
- "counter", WordCounter.class);
+ "word", wordClass,
+ "counter", wordCounterClass)
+ .entrySet()
+ .stream()
+ .map(entry -> entry.getKey() + ":" + entry.getValue().getName())
+ .collect(Collectors.joining(","));
}
}
import org.springframework.util.MultiValueMap;
import java.util.Map;
-import java.util.stream.Collectors;
import static de.juplo.kafka.wordcount.counter.CounterApplicationConfiguriation.serializationConfig;
import static de.juplo.kafka.wordcount.counter.CounterStreamProcessor.STORE_NAME;
private static String typeMappingsConfig()
{
- return typeMappings()
- .entrySet()
- .stream()
- .map(entry -> entry.getKey() + ":" + entry.getValue().getName())
- .collect(Collectors.joining(","));
- }
-
- private static Map<String, Class> typeMappings()
- {
- return Map.of(
- "word", TestOutputWord.class,
- "counter", TestOutputWordCounter.class);
+ return CounterStreamProcessor.typeMappingsConfig(TestOutputWord.class, TestOutputWordCounter.class);
}
}