when(servlet3Context.getMajorVersion()).thenReturn(3);
when(servlet3Context.getContextPath()).thenReturn("");
when(servlet3Context.addServlet(anyString(), any(Servlet.class))).thenReturn(mock(ServletRegistration.Dynamic.class));
final FilterConfig filterConfig = spy(new MockFilterConfig());
when(filterConfig.getServletContext()).thenReturn(servlet3Context);
final RequestMonitor requestMonitor = mock(RequestMonitor.class);
when(requestMonitor.monitor(any(MonitoredRequest.class))).then(new Answer<RequestMonitor.RequestInformation<?>>() {
@Override
public RequestMonitor.RequestInformation<?> answer(InvocationOnMock invocation) throws Throwable {
MonitoredRequest<?> request = (MonitoredRequest<?>) invocation.getArguments()[0];
request.execute();
when(requestTrace.toJson()).thenReturn("");