use of com.enonic.xp.trace.TraceManager in project xp by enonic.
the class WebAppHandlerTest method setup.
@BeforeEach
public void setup() {
this.resourceService = Mockito.mock(ResourceService.class);
this.controllerScriptFactory = Mockito.mock(ControllerScriptFactory.class);
this.exceptionRenderer = Mockito.mock(ExceptionRenderer.class);
this.handler = new WebAppHandler();
this.handler.setResourceService(this.resourceService);
this.handler.setControllerScriptFactory(this.controllerScriptFactory);
this.handler.setExceptionMapper(new ExceptionMapperImpl());
this.handler.setExceptionRenderer(this.exceptionRenderer);
this.request = new PortalRequest();
this.request.setRawRequest(Mockito.mock(HttpServletRequest.class));
this.chain = Mockito.mock(WebHandlerChain.class);
Mockito.when(this.resourceService.getResource(Mockito.any())).thenReturn(MockResource.missing(ResourceKey.from("myapp:/unknown.txt")));
Mockito.when(this.exceptionRenderer.render(Mockito.any(), Mockito.any())).thenReturn(WebResponse.create().status(HttpStatus.INTERNAL_SERVER_ERROR).build());
final TraceManager manager = Mockito.mock(TraceManager.class);
final Trace trace = Mockito.mock(Trace.class);
Mockito.when(manager.newTrace(Mockito.any(), Mockito.any())).thenReturn(trace);
Tracer.setManager(manager);
}
Aggregations