This commit is contained in:
James Agnew 2019-10-30 10:38:51 -04:00
parent d3e66680f0
commit 090bb30c89
1 changed files with 6 additions and 4 deletions

View File

@ -6,21 +6,21 @@ import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner; import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.times; import static org.mockito.Mockito.*;
import static org.mockito.Mockito.verify;
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
public class SearchParamExtractorServiceTest { public class SearchParamExtractorServiceTest {
private SearchParamExtractorService mySvc; private SearchParamExtractorService mySvc;
@Autowired @Mock
private IInterceptorBroadcaster myRequestInterceptorBroadcaster; private IInterceptorBroadcaster myRequestInterceptorBroadcaster;
@Autowired @Mock
private IInterceptorBroadcaster myJpaInterceptorBroadcaster; private IInterceptorBroadcaster myJpaInterceptorBroadcaster;
@Before @Before
@ -35,6 +35,8 @@ public class SearchParamExtractorServiceTest {
searchParamSet.addWarning("help i'm a bug"); searchParamSet.addWarning("help i'm a bug");
searchParamSet.addWarning("Spiff"); searchParamSet.addWarning("Spiff");
when(myJpaInterceptorBroadcaster.callHooks(any(), any())).thenReturn(true);
mySvc.handleWarnings(new ServletRequestDetails(myRequestInterceptorBroadcaster), searchParamSet); mySvc.handleWarnings(new ServletRequestDetails(myRequestInterceptorBroadcaster), searchParamSet);
verify(myJpaInterceptorBroadcaster, times(2)).callHooks(eq(Pointcut.JPA_PERFTRACE_WARNING), any()); verify(myJpaInterceptorBroadcaster, times(2)).callHooks(eq(Pointcut.JPA_PERFTRACE_WARNING), any());