if (jsonExpectation == null || jsonExpectation.isEmpty()) {
throw new IllegalArgumentException("Expected an JSON expectation object but http body is empty");
}
Expectation expectation = null;
try {
ExpectationDTO expectationDTO = objectMapper.readValue(jsonExpectation, ExpectationDTO.class);
if (expectationDTO != null) {
expectation = expectationDTO.buildObject();
}
} catch (IOException ioe) {
logger.error("Exception while parsing response [" + jsonExpectation + "] for http response expectation", ioe);
throw new RuntimeException("Exception while parsing response [" + jsonExpectation + "] for http response expectation", ioe);
}