await cleanup

This commit is contained in:
Ken Stevens 2019-10-01 21:16:06 -04:00
parent f0b2bb8309
commit 028febfe45
2 changed files with 19 additions and 8 deletions

View File

@ -1,4 +1,5 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@ -122,6 +123,11 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>

View File

@ -6,6 +6,7 @@ import org.hl7.fhir.dstu3.model.Subscription;
import org.junit.After;
import org.springframework.beans.factory.annotation.Autowired;
import static org.awaitility.Awaitility.await;
import static org.junit.Assert.assertEquals;
public abstract class BaseSubscriptionRegistryTest extends BaseSubscriptionDstu3Test {
@ -21,7 +22,11 @@ public abstract class BaseSubscriptionRegistryTest extends BaseSubscriptionDstu3
@After
public void clearRegistryAfter() {
mySubscriptionRegistry.unregisterAllSubscriptions();
assertRegistrySize(0);
await().until(this::registryEmpty);
}
public boolean registryEmpty() {
return mySubscriptionChannelRegistry.size() == 0;
}
protected Subscription createSubscription() {