Ejemplo n.º 1
0
  public void testSendSMSNULLTextService() {

    // Arrange
    SMSDto dto = new SMSDto(SMS_NUMBER_SEND_ON, SMS_NUMBER_RECEIVE_ON, null);
    ProcessSendSMSService sendService = new ProcessSendSMSService(dto);
    ProcessReceiveSMSService receiveService = new ProcessReceiveSMSService(dto);

    // Act
    try {
      sendService.execute();
      receiveService.execute();
      fail("SMS was send. Should throw an exception.");
    } catch (AnacomException e) {
    }
  }
Ejemplo n.º 2
0
  public void testSendSMSSenderPhoneOFFService() {

    // Arrange
    SMSDto dto = new SMSDto(SMS_NUMBER_SEND_OFF, SMS_NUMBER_RECEIVE_ON, SMS_MESSAGE_OFF);
    ProcessSendSMSService sendService = new ProcessSendSMSService(dto);
    ProcessReceiveSMSService receiveService = new ProcessReceiveSMSService(dto);

    // Act
    try {
      sendService.execute();
      receiveService.execute();
      fail("SMS was send. Should throw an exception.");
    } catch (PhoneException e) {
    }
  }
Ejemplo n.º 3
0
  public void testSendSMSReceiverInsuficientBalanceService() {

    // Arrange
    SMSDto dto = new SMSDto(SMS_NUMBER_WITHOUT_BALANCE, SMS_NUMBER_RECEIVE_ON, SMS_MESSAGE);
    ProcessSendSMSService sendService = new ProcessSendSMSService(dto);
    ProcessReceiveSMSService receiveService = new ProcessReceiveSMSService(dto);

    // Act
    try {
      sendService.execute();
      receiveService.execute();
      fail("SMS was send. Should throw an exception.");
    } catch (PhoneException e) {
    }
  }
Ejemplo n.º 4
0
  public void testSendSMSReceiverPhoneSILENCEService() {

    // Arrange
    SMSDto dto = new SMSDto(SMS_NUMBER_SEND_ON, SMS_NUMBER_RECEIVE_SILENCE, SMS_MESSAGE_SILENCE);
    ProcessSendSMSService sendService = new ProcessSendSMSService(dto);
    ProcessReceiveSMSService receiveService = new ProcessReceiveSMSService(dto);

    // Act
    try {
      sendService.execute();
      receiveService.execute();
    } catch (PhoneException e) {
      fail("SMS was not send. Should be sent and should not throw an exception.");
    }

    assertTrue("SMS sent", checkSMS(SMS_NUMBER_SEND_ON, SMS_MESSAGE_SILENCE));
    assertTrue("SMS received", checkSMS(SMS_NUMBER_RECEIVE_SILENCE, SMS_MESSAGE_SILENCE));
  }
Ejemplo n.º 5
0
  public void testSendSMSSenderPhoneSILENCEService() {

    // Arrange
    SMSDto dto = new SMSDto(SMS_NUMBER_SEND_SILENCE, SMS_NUMBER_RECEIVE_ON, SMS_MESSAGE_SILENCE);
    ProcessSendSMSService sendService = new ProcessSendSMSService(dto);
    ProcessReceiveSMSService receiveService = new ProcessReceiveSMSService(dto);

    // Act
    try {
      sendService.execute();
      receiveService.execute();
    } catch (PhoneException e) {
      fail("SMS was not send. " + "Should be sent without throwing an exception.");
    }

    // Assert
    assertTrue("SMS Exists", checkSMS(SMS_NUMBER_SEND_SILENCE, SMS_MESSAGE_SILENCE));
    assertTrue("SMS Exists ", checkSMS(SMS_NUMBER_RECEIVE_ON, SMS_MESSAGE_SILENCE));
  }
Ejemplo n.º 6
0
  public void testSendSMSServiceTest() {

    // Arrange
    SMSDto dto = new SMSDto(SMS_NUMBER_SEND_ON, SMS_NUMBER_RECEIVE_ON, SMS_MESSAGE);
    ProcessSendSMSService sendService = new ProcessSendSMSService(dto);
    ProcessReceiveSMSService receiveService = new ProcessReceiveSMSService(dto);

    // Act
    try {
      sendService.execute();
      receiveService.execute();
    } catch (AnacomException e) {
      fail("SMS does not exist yet. " + "Should be added without throwing an exception.");
    }

    // Assert
    assertTrue("SMS Exists ", checkSMS(SMS_NUMBER_RECEIVE_ON, SMS_MESSAGE));
    assertFalse("SMS not exists", checkSMS(SMS_NUMBER_RECEIVE_ON, SMS_MESSAGE_DIFF));
    assertTrue("SMS Exists ", checkSMS(SMS_NUMBER_SEND_ON, SMS_MESSAGE));
    assertFalse("SMS not exists", checkSMS(SMS_NUMBER_SEND_ON, SMS_MESSAGE_DIFF));
  }
Ejemplo n.º 7
0
  public void testSendSMSReceiverPhoneOFFService() {

    // Arrange
    SMSDto dto = new SMSDto(SMS_NUMBER_SEND_ON, SMS_NUMBER_RECEIVE_OFF, SMS_MESSAGE_OFF);
    ProcessSendSMSService sendService = new ProcessSendSMSService(dto);
    ProcessReceiveSMSService receiveService = new ProcessReceiveSMSService(dto);

    // Act
    try {
      sendService.execute();
      receiveService.execute();
    } catch (PhoneException e) {
      fail("SMS was not send. Should be sent and should not throw an exception.");
    }

    // Assert
    assertTrue("SMS sent", checkSMS(SMS_NUMBER_SEND_ON, SMS_MESSAGE_OFF));

    /* BUG: QUANDO RECEIVER PHONE ESTA OFF ELE ADICIONA A MENSAGEM NA MESMA ??!!? */
    // assertFalse("SMS not received", checkSMS(SMS_NUMBER_RECEIVE_OFF,
    // SMS_MESSAGE_OFF));
  }