ROT: Merge der korrigierten Test-Logik deserialization -> into sumup-adder
authorKai Moritz <kai@juplo.de>
Fri, 19 Aug 2022 09:53:58 +0000 (11:53 +0200)
committerKai Moritz <kai@juplo.de>
Fri, 19 Aug 2022 09:56:54 +0000 (11:56 +0200)
* Der Merge korrigiert die grundsätzlichen Fehler der Test-Logik in
  `GenericApplicationTests` durch den Merge des Fixes aus dem Branch
  `deserialization`.
* Zusammen mit dem Merge von `sumup-adder--ohne--stored-offsets` der
  einen Fehler der fachlichen Test-Logik in `ApplicationTests` korrigiert,
  korrigiert dies die technichschen Fehler in der Test-Logik.
* ROT: Der Test schlägt trotzdem noch fehl, da die Annahmen über den
  Zustand des Consumers falsch formuliert wurden.

1  2 
src/test/java/de/juplo/kafka/GenericApplicationTests.java

@@@ -342,20 -336,17 +360,20 @@@ abstract class GenericApplicationTests<
                doForCurrentOffsets((tp, offset) ->
                {
                        oldOffsets.put(tp, offset - 1);
-                       newOffsets.put(tp, offset - 1);
+                       seenOffsets.put(tp, offset - 1);
                });
  
 -              Consumer<ConsumerRecord<K, V>> captureOffsetAndExecuteTestHandler =
 -                              record ->
 +              TestRecordHandler<K, V> captureOffsetAndExecuteTestHandler =
 +                              new TestRecordHandler<K, V>(recordHandler)
                                {
 -                                      seenOffsets.put(
 -                                                      new TopicPartition(record.topic(), record.partition()),
 -                                                      record.offset());
 -                                      receivedRecords.add(record);
 -                                      consumer.accept(record);
 +                                      @Override
 +                                      public void onNewRecord(ConsumerRecord<K, V> record)
 +                                      {
-                                               newOffsets.put(
++                                              seenOffsets.put(
 +                                                              new TopicPartition(record.topic(), record.partition()),
 +                                                              record.offset());
 +                                              receivedRecords.add(record);
 +                                      }
                                };
  
                endlessConsumer =