Add Stream Application Test Support for TestContainers

This commit is contained in:
David Turanski
2020-10-26 14:02:39 -04:00
parent 6025f7ff0b
commit 73fe97272a
2 changed files with 20 additions and 2 deletions

View File

@@ -19,6 +19,7 @@ package org.springframework.cloud.stream.app.test.integration;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function;
@@ -147,5 +148,22 @@ public abstract class AbstractTestTopicListener implements TestTopicListener {
public boolean isSatisfied() {
return this.satisfied.get();
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Verifier verifier = (Verifier) o;
return predicate.equals(verifier.predicate);
}
@Override
public int hashCode() {
return Objects.hash(predicate);
}
}
}

View File

@@ -55,10 +55,10 @@ public class KafkaStreamApplicationIntegrationTestSupportTests extends KafkaStre
void verifierOnTheFly() {
kafkaTemplate.send(STREAM_APPLICATIONS_TEST_TOPIC, "hello test3");
kafkaTemplate.send(STREAM_APPLICATIONS_TEST_TOPIC, "hello test4");
await().atMost(Duration.ofSeconds(30))
.until(verifyOutputPayload((s -> s.equals("hello test4"))));
await().atMost(Duration.ofSeconds(30))
.until(verifyOutputPayload((s -> s.equals("hello test3"))));
await().atMost(Duration.ofSeconds(30))
.until(verifyOutputPayload((s -> s.equals("hello test4"))));
}