Package com.consol.citrus.exceptions

Examples of com.consol.citrus.exceptions.ValidationException


       
        try {
            validateText(receivedMessage.getPayload().toString().trim(),
                    context.replaceDynamicContentInString(controlMessage.getPayload().toString().trim()));
        } catch (IllegalArgumentException e) {
            throw new ValidationException("Failed to validate plain text", e);
        }
       
        log.info("Plain text validation finished successfully: All values OK");
    }
View Full Code Here


            } catch (InstantiationException e) {
                throw new CitrusRuntimeException(e);
            } catch (IllegalAccessException e) {
                throw new CitrusRuntimeException(e);
            } catch (AssertionError e) {
                throw new ValidationException("Groovy SQL result set validation failed with assertion error:\n" + e.getMessage(), e);
            }
        }
    }
View Full Code Here

            action.execute(context);
        } catch (Exception e) {
            log.info("Validating caught exception ...");
           
            if (!exception.isAssignableFrom(e.getClass())) {
                throw new ValidationException("Validation failed for asserted exception type - expected: '" +
                        exception + "' but was: '" + e.getClass().getName() + "'", e);
            }   
           
            if (message != null) {
                if (ValidationMatcherUtils.isValidationMatcherExpression(message)) {
                    ValidationMatcherUtils.resolveValidationMatcher("message", e.getLocalizedMessage(), message, context);
                } else if(!context.replaceDynamicContentInString(message).equals(e.getLocalizedMessage())) {
                    throw new ValidationException("Validation failed for asserted exception message - expected: '" +
                        message + "' but was: '" + e.getLocalizedMessage() + "'", e);
                }
            }
           
            log.info("Exception is as expected: " + e.getClass() + ": " + e.getLocalizedMessage());
            log.info("Exception validation successful");
            return;
        }

        throw new ValidationException("Missing asserted exception '" + exception + "'");
    }
View Full Code Here

TOP

Related Classes of com.consol.citrus.exceptions.ValidationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.