compareStrings(assertMsg, expected, actual);
}
}
private void compareHeaders(HttpExchange httpConn, String checkHeaders) throws Exception {
ContentExchange exch = (ContentExchange) httpConn;
String[] headerList = checkHeaders.split(Strings.NL);
for (String header : headerList) {
String[] nameValue = header.split(":", 2);
if (nameValue[0].equals("responseCode")) {
if (Integer.parseInt(nameValue[1].trim()) != exch.getResponseStatus()) {
error("Incorrect Response Status",
String.format("%d expected %s", exch.getResponseStatus(), nameValue[1]));
}
} else {
if (!nameValue[1].trim().equals(exch.getResponseFields().getStringField(nameValue[0]))) {
error("Incorrect Response Header", String.format("%s expected %s", exch.getResponseFields()
.getStringField(nameValue[0]), nameValue[1].trim()));
}
}
}
}