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> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
@ -116,12 +117,17 @@
<artifactId>jackson-databind</artifactId> <artifactId>jackson-databind</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-test-utilities</artifactId> <artifactId>hapi-fhir-test-utilities</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
<pluginManagement> <pluginManagement>

View File

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