From a89b6d6a026cc32da8186d52c48b25ac1e6249c2 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Fri, 19 Aug 2022 12:07:08 +0200 Subject: [PATCH] =?utf8?q?GR=C3=9CN:=20Korrektur=20der=20falsch=20formulie?= =?utf8?q?rten=20Erwartungen=20zu=20dem=20Consumer-Zustand?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../java/de/juplo/kafka/ApplicationTests.java | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/test/java/de/juplo/kafka/ApplicationTests.java b/src/test/java/de/juplo/kafka/ApplicationTests.java index 740c09c..7246e17 100644 --- a/src/test/java/de/juplo/kafka/ApplicationTests.java +++ b/src/test/java/de/juplo/kafka/ApplicationTests.java @@ -4,6 +4,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.kafka.clients.producer.ProducerRecord; import org.apache.kafka.common.serialization.StringSerializer; import org.apache.kafka.common.utils.Bytes; +import org.assertj.core.api.Assertions; import org.springframework.beans.factory.annotation.Autowired; import java.util.*; @@ -124,15 +125,29 @@ public class ApplicationTests extends GenericApplicationTests tests.stateRepository.findById(Integer.toString(i)).get(); stateDocument - .results.entrySet().stream() + .results + .entrySet() + .stream() .forEach(entry -> { String user = entry.getKey(); List resultsForUser = entry.getValue(); + for (int j=0; j < resultsForUser.size(); j++) + { + if (!(j < state.get(user).size())) + { + break; + } + + assertThat(resultsForUser.get(j)) + .as("Unexpected results calculation %i of user %s", j, user) + .isEqualTo(state.get(user).get(j)); + } + assertThat(state.get(user)) - .as("Unexpected results for user %s", user) - .containsExactlyElementsOf(resultsForUser); + .as("More results calculated for user %s as expected", user) + .containsAll(resultsForUser); }); } } -- 2.20.1