Typisierung in `GenericApplicationTest` nur noch, wo wirklich nötig
[demos/kafka/training] / src / test / java / de / juplo / kafka / ApplicationTest.java
index d3ff3b1..81165ab 100644 (file)
@@ -14,8 +14,7 @@ public class ApplicationTest extends GenericApplicationTest<String, Long>
   public ApplicationTest()
   {
     super(
-        new StringSerializer(),
-        new RecordGenerator<> ()
+        new RecordGenerator()
         {
           final StringSerializer stringSerializer = new StringSerializer();
           final LongSerializer longSerializer = new LongSerializer();
@@ -25,7 +24,7 @@ public class ApplicationTest extends GenericApplicationTest<String, Long>
           public void generate(
               int numberOfMessagesToGenerate,
               Set<Integer> poisonPills,
-              Consumer<ProducerRecord<String, Bytes>> messageSender)
+              Consumer<ProducerRecord<Bytes, Bytes>> messageSender)
           {
             int i = 0;
 
@@ -41,11 +40,11 @@ public class ApplicationTest extends GenericApplicationTest<String, Long>
                         ? new Bytes(stringSerializer.serialize(TOPIC, "BOOM!"))
                         : new Bytes(longSerializer.serialize(TOPIC, (long)i));
 
-                ProducerRecord<String, Bytes> record =
+                ProducerRecord<Bytes, Bytes> record =
                     new ProducerRecord<>(
                         TOPIC,
                         partition,
-                        Integer.toString(partition*10+key%2),
+                        new Bytes(stringSerializer.serialize(TOPIC,Integer.toString(partition*10+key%2))),
                         value);
 
                 messageSender.accept(record);