fix a couple of intermittents

This commit is contained in:
Ken Stevens 2024-09-04 21:45:43 -04:00
parent 4e89317fbf
commit 75046c2fcb
1 changed files with 8 additions and 2 deletions

View File

@ -40,6 +40,7 @@ public class HashMapResourceProviderExtension<T extends IBaseResource> extends H
private final RestfulServerExtension myRestfulServerExtension;
private boolean myClearBetweenTests = true;
private boolean myInitialized = false;
private final List<T> myUpdates = new ArrayList<>();
/**
@ -55,7 +56,9 @@ public class HashMapResourceProviderExtension<T extends IBaseResource> extends H
@Override
public void afterEach(ExtensionContext context) throws Exception {
myRestfulServerExtension.getRestfulServer().unregisterProvider(HashMapResourceProviderExtension.this);
if (myClearBetweenTests) {
myRestfulServerExtension.getRestfulServer().unregisterProvider(HashMapResourceProviderExtension.this);
}
}
@Override
@ -77,8 +80,11 @@ public class HashMapResourceProviderExtension<T extends IBaseResource> extends H
if (myClearBetweenTests) {
clear();
clearCounts();
myRestfulServerExtension.getRestfulServer().registerProvider(HashMapResourceProviderExtension.this);
} else if (!myInitialized) {
myInitialized = true;
myRestfulServerExtension.getRestfulServer().registerProvider(HashMapResourceProviderExtension.this);
}
myRestfulServerExtension.getRestfulServer().registerProvider(HashMapResourceProviderExtension.this);
}
@Override