title: Read all Response header and store in String and print them in rest assured java
body: <p>I have requirement where need to read the all response header and assert them with pre-define values store in the Hashmap. I have written the following codes but getting error as Indexout of bound</p>
  
  <pre><code>Boolean IsPass = false;
  Map.Entry&lt;String, String&gt; item : AssertHeaderFromExcel.entrySet()) {
  
                              try {
                                  String key = item.getKey();
                                  String value = item.getValue();
                                  Headers headers = response.getHeaders();
                                  String strjson = headers.getValues(key).size() &gt; 0 ? headers.getValues(key).get(0) : "";
  
                                  System.out.println("test" +headers.getValues(key));
  
                                  strjson = strjson == null ? "" : strjson;
                                   Assert.assertEquals(strjson, value);
                                  if (value.equalsIgnoreCase(strjson)) {
                                      if (IsPass) {
                                          IsPass = true;
                                      }
                                  } else {
                                      IsPass = false;
                                  }
  
  </code></pre>
  
  <p>The String value is blank for the first value read from the Hashmap. Hence cannot assert the key and value and IsPass remains as Fail only</p>