### Question:
ShadowTrafficAdapter { public HttpHeaders createHeaders(DrShadowHttpServletRequest request, Map<String, String> customHeaders, List<String> forwardOnlyHeaders) { HttpHeaders headers = getHeaders(request, forwardOnlyHeaders); headers.add(IS_SHADOW_TRAFFIC_KEY, IS_SHADOW_TRAFFIC_VALUE); headers.add(SHADOW_TRAFFIC_FROM_KEY, machineName); addContentTypeUtf8CharsetIfNotSet(headers); if (MapUtils.isNotEmpty(customHeaders)) { for (Map.Entry<String, String> entry : customHeaders.entrySet()) { headers.add(SHADOW_TRAFFIC_PREFIX_CUSTOM_KEY + entry.getKey(), entry.getValue()); } } return headers; } ShadowTrafficAdapter(ShadowTrafficConfigHelper shadowTrafficConfigHelper, String machineName); HttpHeaders createHeaders(DrShadowHttpServletRequest request, Map<String, String> customHeaders, List<String> forwardOnlyHeaders); @Async("shadowTrafficTaskExecutor") void invokeShadowTraffic(DrShadowHttpServletRequest drShadowHttpServletRequest, HttpServletRequest originalHttpServletRequest);  }### Answer:
@Test public void testHeaderCreationWithApplicationJsonUTF8Set() { Vector headerNames = new Vector(); headerNames.add("Content-Type"); Enumeration<String> headers = headerNames.elements(); when(shadowServletRequest.getHeaderNames()).thenReturn(headers); when(shadowServletRequest.getHeader(eq("Content-Type"))).thenReturn(MediaType.APPLICATION_JSON_VALUE); HttpHeaders httpHeaders = shadowTrafficAdapter.createHeaders(shadowServletRequest, new HashMap<>(), Arrays.asList("Content-Type")); HttpHeaders expectedHeaders = new HttpHeaders(); expectedHeaders.add(IS_SHADOW_TRAFFIC_KEY, IS_SHADOW_TRAFFIC_VALUE); expectedHeaders.add(SHADOW_TRAFFIC_FROM_KEY, machineName); expectedHeaders.add("Content-Type", MediaType.APPLICATION_JSON_UTF8_VALUE); Assert.assertEquals(expectedHeaders, httpHeaders); }
@Test public void testHeaderCreationWithCustomHeaders() { Map<String, String> customHeaders = new HashMap<>(); customHeaders.put("carlson", "tse"); HttpHeaders httpHeaders = shadowTrafficAdapter.createHeaders(shadowServletRequest, customHeaders, new ArrayList<>()); HttpHeaders expectedHeaders = new HttpHeaders(); expectedHeaders.add(IS_SHADOW_TRAFFIC_KEY, IS_SHADOW_TRAFFIC_VALUE); expectedHeaders.add(SHADOW_TRAFFIC_FROM_KEY, machineName); expectedHeaders.add("shadow-traffic-carlson", "tse"); Assert.assertEquals(expectedHeaders, httpHeaders); }