package ru.headhunter.smsengine;
import ru.headhunter.smsengine.client.SmsMessage;
import junit.framework.TestCase;
public class DecodePduTest extends TestCase {
public void testPduGSM() throws Exception {
String pdu = "07919730071111F1240B919750633702F50000607071011385000CD4F29C0E6A97E7F3F0B90C";
SmsMessage smsMessage = SMSTools.decodePdu(pdu);
System.out.println("Message from [" + smsMessage.getFromPhone() + "], text: [" + smsMessage.getMessageBody() + "]");
assertEquals("79053673205", smsMessage.getFromPhone());
assertEquals("Test message", smsMessage.getMessageBody());
}
public void testPduUSC2() throws Exception {
String pdu = "07919730071111F1240B919750633702F50008607071213085002204220435044104420020043D04300020043A043804400438043B043B043804460435";
SmsMessage smsMessage = SMSTools.decodePdu(pdu);
System.out.println("Message from [" + smsMessage.getFromPhone() + "], text: [" + smsMessage.getMessageBody() + "]");
assertEquals("79053673205", smsMessage.getFromPhone());
assertEquals("Тест на кириллице", smsMessage.getMessageBody());
}
public void testAlphanumericSenderNumber() throws Exception {
String pdu = "07919720730005F82010D0D0B25B1F6E1DA74D0008509080328054217A041204300448002004310430043B0430043D0441002000380035002E003200370020042004430431002E0020041F043E04360430043B04430439044104420430002C0020043F043E043F043E043B043D043804420435002004310430043B0430043D0441002E0020041F0435043D04370430002D00470053004D";
SmsMessage smsMessage = SMSTools.decodePdu(pdu);
System.out.println("Message from [" + smsMessage.getFromPhone() + "], text: [" + smsMessage.getMessageBody() + "]");
assertEquals("Penza-GSM", smsMessage.getFromPhone());
assertEquals("Ваш баланс 85.27 Руб. Пожалуйста, пополните баланс. Пенза-GSM", smsMessage.getMessageBody());
}
}