Search in sources :

Example 61 with ConstraintViolation

use of javax.validation.ConstraintViolation in project camel by apache.

the class CMConfigurationTest method testNullDefaultFrom.

@Test
public void testNullDefaultFrom() throws Exception {
    final CMConfiguration configuration = new CMConfiguration();
    // length: 1-11
    configuration.setDefaultFrom(null);
    configuration.setProductToken(UUID.randomUUID().toString());
    configuration.setDefaultMaxNumberOfParts(8);
    configuration.setTestConnectionOnStartup(false);
    final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(configuration);
    Assert.isTrue(1 == constraintViolations.size());
}
Also used : ConstraintViolation(javax.validation.ConstraintViolation) CMConfiguration(org.apache.camel.component.cm.CMConfiguration) Test(org.junit.Test)

Example 62 with ConstraintViolation

use of javax.validation.ConstraintViolation in project camel by apache.

the class CMConfigurationTest method testDefaultFromFieldMaxLength.

@Test
public void testDefaultFromFieldMaxLength() throws Exception {
    final CMConfiguration configuration = new CMConfiguration();
    // length: 1-11
    configuration.setDefaultFrom("123456789012");
    configuration.setProductToken(UUID.randomUUID().toString());
    configuration.setDefaultMaxNumberOfParts(8);
    configuration.setTestConnectionOnStartup(false);
    final Set<ConstraintViolation<CMConfiguration>> constraintViolations = validator.validate(configuration);
    Assert.isTrue(1 == constraintViolations.size());
}
Also used : ConstraintViolation(javax.validation.ConstraintViolation) CMConfiguration(org.apache.camel.component.cm.CMConfiguration) Test(org.junit.Test)

Example 63 with ConstraintViolation

use of javax.validation.ConstraintViolation in project camel by apache.

the class SMSMessageTest method testIdAsStringFieldZeroLength.

@Test
public void testIdAsStringFieldZeroLength() throws Exception {
    String zeroLengthIdAsString = "";
    final SMSMessage m = new SMSMessage(zeroLengthIdAsString, "Hello World", validNumber, "MySelf");
    final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
    Assert.isTrue(1 == constraintViolations.size());
}
Also used : SMSMessage(org.apache.camel.component.cm.client.SMSMessage) ConstraintViolation(javax.validation.ConstraintViolation) Test(org.junit.Test)

Example 64 with ConstraintViolation

use of javax.validation.ConstraintViolation in project camel by apache.

the class SMSMessageTest method testNullPhoneNumber.

@Test
public void testNullPhoneNumber() throws Exception {
    final SMSMessage m = new SMSMessage("Hello world!", null);
    final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
    Assert.isTrue(1 == constraintViolations.size());
}
Also used : SMSMessage(org.apache.camel.component.cm.client.SMSMessage) ConstraintViolation(javax.validation.ConstraintViolation) Test(org.junit.Test)

Example 65 with ConstraintViolation

use of javax.validation.ConstraintViolation in project camel by apache.

the class SMSMessageTest method testE164NumberWithPlusSignIsInvalid.

@Test
public void testE164NumberWithPlusSignIsInvalid() throws Exception {
    final String phoneNumber = "+34 600 00 00 00";
    final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
    final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
    Assert.isTrue(1 == constraintViolations.size());
}
Also used : SMSMessage(org.apache.camel.component.cm.client.SMSMessage) ConstraintViolation(javax.validation.ConstraintViolation) Test(org.junit.Test)

Aggregations

ConstraintViolation (javax.validation.ConstraintViolation)95 Test (org.junit.Test)78 Validator (javax.validation.Validator)19 ConstraintViolationException (javax.validation.ConstraintViolationException)12 SMSMessage (org.apache.camel.component.cm.client.SMSMessage)12 ChangePasswordForm (org.orcid.frontend.web.forms.ChangePasswordForm)11 CmsDocumentBlobSegment (gov.ca.cwds.data.persistence.cms.CmsDocumentBlobSegment)10 ValidatorFactory (javax.validation.ValidatorFactory)9 ManagePasswordOptionsForm (org.orcid.frontend.web.forms.ManagePasswordOptionsForm)8 ArrayList (java.util.ArrayList)6 HashSet (java.util.HashSet)6 CMConfiguration (org.apache.camel.component.cm.CMConfiguration)6 Set (java.util.Set)5 InitialContext (javax.naming.InitialContext)5 Session (org.hibernate.Session)5 Transaction (org.hibernate.Transaction)5 Method (java.lang.reflect.Method)4 ExecutableValidator (javax.validation.executable.ExecutableValidator)4 CamelExecutionException (org.apache.camel.CamelExecutionException)4 Exchange (org.apache.camel.Exchange)4