use of javax.validation.ConstraintViolation in project camel by apache.
the class SMSMessageTest method testE164NullNumberIsInValid.
@Test
public void testE164NullNumberIsInValid() throws Exception {
final String phoneNumber = null;
final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
Assert.isTrue(1 == constraintViolations.size());
}
use of javax.validation.ConstraintViolation in project camel by apache.
the class SMSMessageTest method testE164NoPlusSignedNumberBut00IsInvalid.
@Test
public void testE164NoPlusSignedNumberBut00IsInvalid() throws Exception {
final String phoneNumber = new PhoneNumber().setCountryCodeSource(CountryCodeSource.FROM_NUMBER_WITHOUT_PLUS_SIGN).setNationalNumber(0034600000000).toString();
final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
Assert.isTrue(1 == constraintViolations.size());
}
use of javax.validation.ConstraintViolation in project camel by apache.
the class SMSMessageTest method testIdAsStringMaxLength.
@Test
public void testIdAsStringMaxLength() throws Exception {
String idAsString = "thisistheidastringlengthgreaterthan32";
final SMSMessage m = new SMSMessage(idAsString, "Hello World", validNumber, "MySelf");
final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
Assert.isTrue(1 == constraintViolations.size());
}
use of javax.validation.ConstraintViolation in project camel by apache.
the class SMSMessageTest method testE164NoPlusSignedNumberIsInvalid.
@Test
public void testE164NoPlusSignedNumberIsInvalid() throws Exception {
final String phoneNumber = "34600000000";
final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
Assert.isTrue(1 == constraintViolations.size());
}
use of javax.validation.ConstraintViolation in project camel by apache.
the class SMSMessageTest method testNullMessageField.
@Test
public void testNullMessageField() throws Exception {
final SMSMessage m = new SMSMessage(null, validNumber);
final Set<ConstraintViolation<SMSMessage>> constraintViolations = validator.validate(m);
Assert.isTrue(1 == constraintViolations.size());
}
Aggregations