### Question:
AdapterRestClient extends RestClient { @Override protected void initializeHeaderMap(Map<String, String> headerMap) { headerMap.put("Authorization", this.getBasicAuth(adapterRestProperties.getAuth(), adapterRestProperties.getKey())); } AdapterRestClient(AdapterRestProperties props, URI uri);  AdapterRestClient(AdapterRestProperties props, URI uri, String accept, String contentType); @Override ONAPComponents getTargetEntity();  }### Answer:
@Test public void initializeHeaderMap_success() throws URISyntaxException, GeneralSecurityException { String encyptedMessage = CryptoUtils.encrypt("testAdapter", CRYPTO_KEY); when(adapterRestPropertiesMock.getAuth()).thenReturn(encyptedMessage); when(adapterRestPropertiesMock.getKey()).thenReturn(CRYPTO_KEY); AdapterRestClient testedObject = new AdapterRestClient(adapterRestPropertiesMock, new URI("")); testedObject.initializeHeaderMap(headerMap); assertThat(headerMap).containsOnly(entry("Authorization", getExpectedEncodedString(encyptedMessage))); }
@Test public void initializeHeaderMap_putNullToMapWhenAuthIsNull() throws URISyntaxException { AdapterRestClient testedObject = new AdapterRestClient(adapterRestPropertiesMock, new URI("")); testedObject.initializeHeaderMap(headerMap); assertThat(headerMap).containsOnly(entry("Authorization", null)); }
@Test public void initializeHeaderMap_putNullToMapWhenExOccurs() throws URISyntaxException, GeneralSecurityException { String encyptedMessage = CryptoUtils.encrypt("testAdapter", CRYPTO_KEY); when(adapterRestPropertiesMock.getAuth()).thenReturn(encyptedMessage); when(adapterRestPropertiesMock.getKey()).thenReturn(INVALID_CRYPTO_KEY); AdapterRestClient testedObject = new AdapterRestClient(adapterRestPropertiesMock, new URI(""), "accept", "contentType"); testedObject.initializeHeaderMap(headerMap); assertThat(headerMap).containsOnly(entry("Authorization", null)); }