use of io.crnk.legacy.locator.SampleJsonServiceLocator in project crnk-framework by crnk-project.
the class BraveResponseFilterTest method setup.
@Before
public void setup() {
boot = new CrnkBoot();
boot.setServiceDiscovery(new ReflectionsServiceDiscovery("io.crnk.test.mock.repository", new SampleJsonServiceLocator()));
boot.boot();
span = Mockito.mock(Span.class);
tracing = Mockito.mock(Tracing.class);
tracer = Mockito.mock(Tracer.class);
Mockito.when(tracing.tracer()).thenReturn(tracer);
Mockito.when(tracer.nextSpan()).thenReturn(span);
moduleContext = Mockito.mock(Module.ModuleContext.class);
Mockito.when(moduleContext.getResourceRegistry()).thenReturn(boot.getResourceRegistry());
QuerySpec querySpec = new QuerySpec(Task.class);
queryAdapter = new QuerySpecAdapter(querySpec, boot.getResourceRegistry());
ResourceInformation taskResourceInformation = boot.getResourceRegistry().getEntry(Task.class).getResourceInformation();
requestSpec = Mockito.mock(RepositoryRequestSpec.class);
Mockito.when(requestSpec.getMethod()).thenReturn(HttpMethod.GET);
Mockito.when(requestSpec.getQueryAdapter()).thenReturn(queryAdapter);
Mockito.when(requestSpec.getQuerySpec(taskResourceInformation)).thenReturn(querySpec);
filter = new BraveRepositoryFilter(tracing, moduleContext);
filterContext = Mockito.mock(RepositoryFilterContext.class);
Mockito.when(filterContext.getRequest()).thenReturn(requestSpec);
filterChain = Mockito.mock(RepositoryRequestFilterChain.class);
}
Aggregations