@Override
  public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
    var requestIdGenerator = platform.getContainer().getOptionalComponentByType(RequestIdGenerator.class);

    if (requestIdGenerator.isEmpty()) {
      chain.doFilter(request, response);
    } else {
      String requestId = requestIdGenerator.get().generate();
      try (RequestIdMDCStorage mdcStorage = new RequestIdMDCStorage(requestId)) {
        request.setAttribute("ID", requestId);
        chain.doFilter(request, response);
      }
    }
  }
@Test
  public void filter_put_id_in_MDC_and_remove_it_after_chain_has_executed() throws IOException, ServletException {
    String requestId = "request id";
    when(requestIdGenerator.generate()).thenReturn(requestId);
    doAnswer(invocation -> assertThat(MDC.get("HTTP_REQUEST_ID")).isEqualTo(requestId))
      .when(filterChain)
      .doFilter(servletRequest, servletResponse);

    underTest.doFilter(servletRequest, servletResponse, filterChain);

    assertThat(MDC.get("HTTP_REQUEST_ID")).isNull();
  }