### Question:
DMaaPRestClient extends RestClient { @Override protected void initializeHeaderMap(Map<String, String> headerMap) { if (auth != null && !auth.isEmpty() && key != null && !key.isEmpty()) { addBasicAuthHeader(auth, key); } String onapRequestId = UUID.randomUUID().toString(); headerMap.put(ONAPLogConstants.Headers.REQUEST_ID, onapRequestId); if (MDC.get(ONAPLogConstants.MDCs.REQUEST_ID) != null) { headerMap.put(ONAPLogConstants.Headers.INVOCATION_ID, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID)); } } DMaaPRestClient(URL url, String contentType, String auth, String key); @Override ONAPComponents getTargetEntity();  }### Answer:
@Test public void headerMapTest() { try { url = new URL("http: } catch (MalformedURLException e) { throw new RuntimeException(e); } DMaaPRestClient client = new DMaaPRestClient(url, contentType, auth, key); Map<String, String> map = new HashMap<>(); client.initializeHeaderMap(map); map.put(ONAPLogConstants.MDCs.REQUEST_ID, "1234"); assertNotNull(map); assertEquals("Found expected RequesttId", "1234", map.get(ONAPLogConstants.MDCs.REQUEST_ID)); }
@Test public void headerMapInvocationIdNotNullTest() { try { url = new URL("http: } catch (MalformedURLException e) { throw new RuntimeException(e); } MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, "1234"); DMaaPRestClient client = new DMaaPRestClient(url, contentType, auth, key); Map<String, String> map = new HashMap<>(); client.initializeHeaderMap(map); assertNotNull(map); assertEquals("Found expected RequestId", "1234", map.get(ONAPLogConstants.Headers.INVOCATION_ID)); }
@Test public void headerMapInvocationIdNullTest() { try { url = new URL("http: } catch (MalformedURLException e) { throw new RuntimeException(e); } MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, null); DMaaPRestClient client = new DMaaPRestClient(url, contentType, auth, key); Map<String, String> map = new HashMap<>(); client.initializeHeaderMap(map); assertNotNull(map); assertEquals("header not found as expected", null, map.get(ONAPLogConstants.Headers.INVOCATION_ID)); }