private HttpServletRequest createMockHttpServletRequest(Map<String, Optional<String>> headers) {
    HttpServletRequest httpServletRequest = Mockito.mock(HttpServletRequest.class);
    headers.entrySet().stream().forEach(
      entry -> Mockito
        .when(httpServletRequest.getHeader(entry.getKey()))
        .thenReturn(entry.getValue().orElse(null))
    );
    return httpServletRequest;
  }
Tests the logic that determines whether a given authentication mode
should be checked based on the Authorization header.
itests/hive-minikdc/src/test/java/org/apache/hive/minikdc/TestIsAuthTypeEnabled.java