Search in sources :

Example 16 with SMSMessage

use of org.apache.camel.component.cm.client.SMSMessage 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 17 with SMSMessage

use of org.apache.camel.component.cm.client.SMSMessage 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 18 with SMSMessage

use of org.apache.camel.component.cm.client.SMSMessage 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)

Example 19 with SMSMessage

use of org.apache.camel.component.cm.client.SMSMessage 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());
}
Also used : SMSMessage(org.apache.camel.component.cm.client.SMSMessage) ConstraintViolation(javax.validation.ConstraintViolation) Test(org.junit.Test)

Example 20 with SMSMessage

use of org.apache.camel.component.cm.client.SMSMessage 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());
}
Also used : SMSMessage(org.apache.camel.component.cm.client.SMSMessage) ConstraintViolation(javax.validation.ConstraintViolation) PhoneNumber(com.google.i18n.phonenumbers.Phonenumber.PhoneNumber) Test(org.junit.Test)

Aggregations

SMSMessage (org.apache.camel.component.cm.client.SMSMessage)24 Test (org.junit.Test)23 ConstraintViolation (javax.validation.ConstraintViolation)12 CMEndpoint (org.apache.camel.component.cm.CMEndpoint)9 CMProducer (org.apache.camel.component.cm.CMProducer)9 PhoneNumber (com.google.i18n.phonenumbers.Phonenumber.PhoneNumber)1 InvalidPayloadRuntimeException (org.apache.camel.InvalidPayloadRuntimeException)1 CMResponseExceptionSender (org.apache.camel.component.cm.test.mocks.cmsender.CMResponseExceptionSender)1 InsufficientBalanceExceptionSender (org.apache.camel.component.cm.test.mocks.cmsender.InsufficientBalanceExceptionSender)1 InvalidMSISDNExceptionSender (org.apache.camel.component.cm.test.mocks.cmsender.InvalidMSISDNExceptionSender)1 InvalidProductTokenExceptionSender (org.apache.camel.component.cm.test.mocks.cmsender.InvalidProductTokenExceptionSender)1 NoAccountFoundForProductTokenExceptionSender (org.apache.camel.component.cm.test.mocks.cmsender.NoAccountFoundForProductTokenExceptionSender)1 NoMessageExceptionSender (org.apache.camel.component.cm.test.mocks.cmsender.NoMessageExceptionSender)1 NotPhoneNumberFoundExceptionSender (org.apache.camel.component.cm.test.mocks.cmsender.NotPhoneNumberFoundExceptionSender)1 UnknownErrorExceptionSender (org.apache.camel.component.cm.test.mocks.cmsender.UnknownErrorExceptionSender)1 UnroutableMessageExceptionSender (org.apache.camel.component.cm.test.mocks.cmsender.UnroutableMessageExceptionSender)1