A couple more test fixes

This commit is contained in:
James Agnew 2018-09-11 08:47:00 -04:00
parent a26779de81
commit 45dac5c5a8
8 changed files with 15 additions and 11 deletions

View File

@ -1,8 +1,8 @@
package ca.uhn.fhir.jpa.dao; package ca.uhn.fhir.jpa.dao;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Matchers.eq; import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;

View File

@ -53,7 +53,7 @@ import java.util.stream.Collectors;
import static ca.uhn.fhir.util.TestUtil.randomizeLocale; import static ca.uhn.fhir.util.TestUtil.randomizeLocale;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import static org.mockito.Matchers.eq; import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@ -330,7 +330,7 @@ public abstract class BaseJpaTest {
return bundleStr; return bundleStr;
} }
public static void purgeDatabase(DaoConfig theDaoConfig, IFhirSystemDao<?, ?> theSystemDao, ISearchParamPresenceSvc theSearchParamPresenceSvc, ISearchCoordinatorSvc theSearchCoordinatorSvc, ISearchParamRegistry theSearchParamRegistry) throws InterruptedException { public static void purgeDatabase(DaoConfig theDaoConfig, IFhirSystemDao<?, ?> theSystemDao, ISearchParamPresenceSvc theSearchParamPresenceSvc, ISearchCoordinatorSvc theSearchCoordinatorSvc, ISearchParamRegistry theSearchParamRegistry) {
theSearchCoordinatorSvc.cancelAllActiveSearches(); theSearchCoordinatorSvc.cancelAllActiveSearches();
boolean expungeEnabled = theDaoConfig.isExpungeEnabled(); boolean expungeEnabled = theDaoConfig.isExpungeEnabled();
@ -345,7 +345,11 @@ public abstract class BaseJpaTest {
ourLog.error("Failed during expunge", e); ourLog.error("Failed during expunge", e);
fail(e.toString()); fail(e.toString());
} else { } else {
Thread.sleep(1000); try {
Thread.sleep(1000);
} catch (InterruptedException e2) {
fail(e2.toString());
}
} }
} }
} }

View File

@ -196,7 +196,7 @@ public abstract class BaseJpaDstu2Test extends BaseJpaTest {
@Before @Before
@Transactional() @Transactional()
public void beforePurgeDatabase() { public void beforePurgeDatabase() throws InterruptedException {
purgeDatabase(myDaoConfig, mySystemDao, mySearchParamPresenceSvc, mySearchCoordinatorSvc, mySearchParamRegistry); purgeDatabase(myDaoConfig, mySystemDao, mySearchParamPresenceSvc, mySearchCoordinatorSvc, mySearchParamRegistry);
} }

View File

@ -43,7 +43,7 @@ import java.util.List;
import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import static org.mockito.Matchers.eq; import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.times; import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;

View File

@ -294,7 +294,7 @@ public abstract class BaseJpaDstu3Test extends BaseJpaTest {
@Before @Before
@Transactional() @Transactional()
public void beforePurgeDatabase() { public void beforePurgeDatabase() throws InterruptedException {
purgeDatabase(myDaoConfig, mySystemDao, mySearchParamPresenceSvc, mySearchCoordinatorSvc, mySearchParamRegsitry); purgeDatabase(myDaoConfig, mySystemDao, mySearchParamPresenceSvc, mySearchCoordinatorSvc, mySearchParamRegsitry);
} }

View File

@ -302,7 +302,7 @@ public abstract class BaseJpaR4Test extends BaseJpaTest {
@Before @Before
@Transactional() @Transactional()
public void beforePurgeDatabase() { public void beforePurgeDatabase() throws InterruptedException {
final EntityManager entityManager = this.myEntityManager; final EntityManager entityManager = this.myEntityManager;
purgeDatabase(myDaoConfig, mySystemDao, mySearchParamPresenceSvc, mySearchCoordinatorSvc, mySearchParamRegsitry); purgeDatabase(myDaoConfig, mySystemDao, mySearchParamPresenceSvc, mySearchCoordinatorSvc, mySearchParamRegsitry);
} }

View File

@ -43,7 +43,7 @@ import java.util.Set;
import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import static org.mockito.Matchers.eq; import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.times; import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;

View File

@ -40,7 +40,7 @@ import java.util.stream.Collectors;
import static org.hamcrest.Matchers.startsWith; import static org.hamcrest.Matchers.startsWith;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import static org.mockito.Matchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*; import static org.mockito.Mockito.*;
public class ResourceProviderInterceptorR4Test extends BaseResourceProviderR4Test { public class ResourceProviderInterceptorR4Test extends BaseResourceProviderR4Test {