public ValidationResult toValidationResult(String responseBody) {
        try {
            ValidationResult validationResult = new ValidationResult();

            if (isEmpty(responseBody)) return validationResult;

            List<Map<String, Object>> errors;
            try {
                errors = GSON.fromJson(responseBody, new TypeToken<List<Map<String, Object>>>() {}.getType());
            } catch (Exception e) {
                throw new RuntimeException("Validation errors should be returned as list of errors, with each error represented as a map");
            }

            for (Map<String, Object> error : errors) {
                String key;
                try {
                    key = (String) error.get("key");
                } catch (Exception e) {
                    throw new RuntimeException("Validation error key should be of type string");
                }

                String message;
                try {
                    message = (String) error.get("message");
                } catch (Exception e) {
                    throw new RuntimeException("Validation message should be of type string");
                }

                if (isEmpty(key)) {
                    validationResult.addError(new ValidationError(message));
                } else {
                    validationResult.addError(new ValidationError(key, message));
                }
            }

            return validationResult;
        } catch (Exception e) {
            throw new RuntimeException(format("Unable to de-serialize json response. %s", e.getMessage()));
        }
    }
@Test
    public void shouldBuildValidationResultFromResponseBody() {
        String responseBody = "[{\"key\":\"key-one\",\"message\":\"incorrect value\"},{\"message\":\"general error\"}]";
        ValidationResult validationResult = messageHandler.toValidationResult(responseBody);
        assertValidationError(validationResult.getErrors().get(0), "key-one", "incorrect value");
        assertValidationError(validationResult.getErrors().get(1), "", "general error");
    }