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.*;
tests.stateRepository.findById(Integer.toString(i)).get();
stateDocument
- .results.entrySet().stream()
+ .results
+ .entrySet()
+ .stream()
.forEach(entry ->
{
String user = entry.getKey();
List<AdderResult> 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);
});
}
}