From 090bb30c8932cbef27e7af855fb1a82796230715 Mon Sep 17 00:00:00 2001 From: James Agnew Date: Wed, 30 Oct 2019 10:38:51 -0400 Subject: [PATCH] Test fix --- .../extractor/SearchParamExtractorServiceTest.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorServiceTest.java b/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorServiceTest.java index 571b77f3577..e724954a7a4 100644 --- a/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorServiceTest.java +++ b/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorServiceTest.java @@ -6,21 +6,21 @@ import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.springframework.beans.factory.annotation.Autowired; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.*; @RunWith(MockitoJUnitRunner.class) public class SearchParamExtractorServiceTest { private SearchParamExtractorService mySvc; - @Autowired + @Mock private IInterceptorBroadcaster myRequestInterceptorBroadcaster; - @Autowired + @Mock private IInterceptorBroadcaster myJpaInterceptorBroadcaster; @Before @@ -35,6 +35,8 @@ public class SearchParamExtractorServiceTest { searchParamSet.addWarning("help i'm a bug"); searchParamSet.addWarning("Spiff"); + when(myJpaInterceptorBroadcaster.callHooks(any(), any())).thenReturn(true); + mySvc.handleWarnings(new ServletRequestDetails(myRequestInterceptorBroadcaster), searchParamSet); verify(myJpaInterceptorBroadcaster, times(2)).callHooks(eq(Pointcut.JPA_PERFTRACE_WARNING), any());