Verbesserte Tests und Korrekturen gemerged: sumup-adder -> stored-offsets
[demos/kafka/training] / src / test / java / de / juplo / kafka / ApplicationTests.java
index 8369a7b..5166227 100644 (file)
@@ -10,7 +10,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Primary;
 import org.springframework.test.context.ContextConfiguration;
 
-import java.util.Set;
 import java.util.function.Consumer;
 
 
@@ -75,12 +74,18 @@ public class ApplicationTests extends GenericApplicationTests<String, Long>
   {
     @Primary
     @Bean
-    public Consumer<ConsumerRecord<String, Long>> consumer()
+    public ApplicationRecordHandler recordHandler()
     {
-      return (record) ->
+      ApplicationRecordHandler recordHandler = new ApplicationRecordHandler();
+      return new ApplicationRecordHandler()
       {
-        if (record.value() == Long.MIN_VALUE)
-          throw new RuntimeException("BOOM (Logic-Error)!");
+        @Override
+        public void accept(ConsumerRecord<String, Long> record)
+        {
+          if (record.value() == Long.MIN_VALUE)
+            throw new RuntimeException("BOOM (Logic-Error)!");
+          super.accept(record);
+        }
       };
     }
   }