Package com.consol.citrus.exceptions

Examples of com.consol.citrus.exceptions.ValidationException


            log.info("SOAP fault as expected: " + soapFaultException.getFaultCode() + ": " + soapFaultException.getFaultStringOrReason());
            log.info("SOAP fault validation successful");
           
            return;
        } catch (RuntimeException e) {
            throw new ValidationException("SOAP fault validation failed for asserted exception type - expected: '" +
                    SoapFaultClientException.class + "' but was: '" + e.getClass().getName() + "'", e);
        } catch (Exception e) {
            throw new ValidationException("SOAP fault validation failed for asserted exception type - expected: '" +
                    SoapFaultClientException.class + "' but was: '" + e.getClass().getName() + "'", e);
        }
       
        throw new ValidationException("SOAP fault validation failed! Missing asserted SOAP fault exception");
    }
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 script validation failed with assertion error:\n" + e.getMessage(), e);
        }
    }
View Full Code Here

        }

        try {
            dateFormat = new SimpleDateFormat(formatString);
        } catch (PatternSyntaxException e) {
            throw new ValidationException(this.getClass().getSimpleName() + " failed for field '" + fieldName + "' " +
                    ". Found invalid date format", e);
        }

        try {
            Calendar cal = Calendar.getInstance();
            cal.setTime(dateFormat.parse(value));

            if (cal.get(Calendar.DAY_OF_WEEK) == Weekday.valueOf(weekday).getConstantValue()) {
                log.info("Successful weekday validation matcher - All values OK");
            } else {
                throw new ValidationException(this.getClass().getSimpleName() + " failed for field '" + fieldName + "'" +
                        ". Received invalid week day '" + value + "', expected date to be a '" + weekday + "'");
            }
        } catch (ParseException e) {
            throw new ValidationException(this.getClass().getSimpleName() + " failed for field '" + fieldName + "'" +
                    ". Received invalid date format for value '" + value + "', expected date format is '" + formatString + "'", e);
        }
    }
View Full Code Here

*/
public class ContainsIgnoreCaseValidationMatcher implements ValidationMatcher {

    public void validate(String fieldName, String value, String control, TestContext context) throws ValidationException {
        if (!value.toLowerCase().contains(control.toLowerCase())) {
            throw new ValidationException(this.getClass().getSimpleName()
                    + " failed for field '" + fieldName
                    + "'. Received value is '" + value
                    + "', control value is '" + control + "'.");
        }
    }
View Full Code Here

      Double dControl;
      try {
        dValue = Double.parseDouble(value);
        dControl = Double.parseDouble(control);
      } catch (Exception e) {
        throw new ValidationException(this.getClass().getSimpleName()
                    + " failed for field '" + fieldName
                    + "'. Received value is '" + value
                    + "', control value is '" + control + "'", e);
    }
     
        if (!(dValue > dControl)) {
            throw new ValidationException(this.getClass().getSimpleName()
                    + " failed for field '" + fieldName
                    + "'. Received value is '" + value
                    + "', control value is '" + control + "'");
        }
    }
View Full Code Here

      Double dControl;
      try {
        dValue = Double.parseDouble(value);
        dControl = Double.parseDouble(control);
      } catch (Exception e) {
        throw new ValidationException(this.getClass().getSimpleName()
                    + " failed for field '" + fieldName
                    + "'. Received value is '" + value
                    + "', control value is '" + control + "'", e);
    }
     
        if (!(dValue < dControl)) {
            throw new ValidationException(this.getClass().getSimpleName()
                    + " failed for field '" + fieldName
                    + "'. Received value is '" + value
                    + "', control value is '" + control + "'");
        }
    }
View Full Code Here

    public void validate(String fieldName, String value, String control, TestContext context) throws ValidationException {
      SimpleDateFormat dateFormat;
      try {
        dateFormat = new SimpleDateFormat(control);
      } catch (PatternSyntaxException e) {
        throw new ValidationException(this.getClass().getSimpleName()
                    + " failed for field '" + fieldName + "' " +
                    ". Found invalid date format", e);
    }
      try {
      dateFormat.parse(value);
    } catch (ParseException e) {
            throw new ValidationException(this.getClass().getSimpleName()
                    + " failed for field '" + fieldName + "'" +
                        ". Received invalid date format for value '" + value
                    + "', expected date format is '" + control + "'", e);
    }
    }
View Full Code Here

*/
public class ContainsValidationMatcher implements ValidationMatcher {

    public void validate(String fieldName, String value, String control, TestContext context) throws ValidationException {
        if (value == null || !value.contains(control)) {
            throw new ValidationException(this.getClass().getSimpleName()
                    + " failed for field '" + fieldName
                    + "'. Received value '" + value
                    + "' must contain '" + control + "'");
        }
    }
View Full Code Here

      boolean success;

      try {
        success = value.matches(control);
      } catch (PatternSyntaxException e) {
        throw new ValidationException(this.getClass().getSimpleName()
                    + " failed for field '" + fieldName
                    + "'. Found invalid pattern syntax", e);
    }
     
        if (!success) {
            throw new ValidationException(this.getClass().getSimpleName()
                    + " failed for field '" + fieldName
                    + "'. Received value is '" + value
                    + "', control value is '" + control + "'");
        }
    }
View Full Code Here

*/
public class StartsWithValidationMatcher implements ValidationMatcher {

    public void validate(String fieldName, String value, String control, TestContext context) throws ValidationException {
        if (!value.startsWith(control)) {
            throw new ValidationException(this.getClass().getSimpleName()
                    + " failed for field '" + fieldName
                    + "'. Received value is '" + value
                    + "', control value is '" + control + "'");
        }
    }
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.