Revision: 28b81f2dd01f
Author:   [email protected] <[email protected]>
Date:     Mon Apr 30 01:33:24 2012
Log:      Issue 26 : Added more test
http://code.google.com/p/jss7/source/detail?r=28b81f2dd01f

Modified:
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/smstpdu/AddressFieldTest.java

=======================================
--- /map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/smstpdu/AddressFieldTest.java Mon Apr 23 10:53:14 2012 +++ /map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/smstpdu/AddressFieldTest.java Mon Apr 30 01:33:24 2012
@@ -23,7 +23,8 @@
 package org.mobicents.protocols.ss7.map.smstpdu;


-import static org.testng.Assert.*;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;

 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -32,11 +33,12 @@

import org.mobicents.protocols.ss7.map.api.smstpdu.NumberingPlanIdentification;
 import org.mobicents.protocols.ss7.map.api.smstpdu.TypeOfNumber;
-import org.testng.annotations.*;
+import org.testng.annotations.Test;

 /**
  *
  * @author sergey vetyutnev
+ * @author amit bhayani
  *
  */
 public class AddressFieldTest {
@@ -45,9 +47,15 @@
                return new byte[] { 11, -111, 39, 34, -125, 72, 35, -15 };
        }

-       public byte[] getDataAlphaNumeric() {
+       //This is real trace
+       public byte[] getDataAlphaNumeric_AWCC() {
return new byte[] { 0x07, (byte) 0xd0, (byte) 0xc1, (byte) 0xeb, 0x70, 0x08 };
        }
+
+       //This is real trace
+       public byte[] getDataAlphaNumeric_Ufone() {
+ return new byte[] { 0x09, (byte) 0xd0, (byte) 0x55, (byte) 0xf3, (byte)0xdb, 0x5d, 0x06 };
+       }

        @Test(groups = { "functional.decode","smstpdu"})
        public void testDecode() throws Exception {
@@ -69,9 +77,9 @@
        }

     @Test(groups = { "functional.decode", "smstpduAlphaNumeric" })
-    public void testDecodeAlphaNumeric() throws Exception {
-
- InputStream stm = new ByteArrayInputStream(this.getDataAlphaNumeric());
+    public void testDecodeAlphaNumericAwcc() throws Exception {
+
+ InputStream stm = new ByteArrayInputStream(this.getDataAlphaNumeric_AWCC());
             AddressFieldImpl impl = AddressFieldImpl.createMessage(stm);
assertEquals(impl.getTypeOfNumber(), TypeOfNumber.Alphanumeric); assertEquals(impl.getNumberingPlanIdentification(), NumberingPlanIdentification.Unknown);
@@ -79,12 +87,32 @@
     }

     @Test(groups = { "functional.encode", "smstpduAlphaNumeric" })
-    public void testEncodeAlphaNumeric() throws Exception {
+    public void testEncodeAlphaNumericAwcc() throws Exception {

AddressFieldImpl impl = new AddressFieldImpl(TypeOfNumber.Alphanumeric, NumberingPlanIdentification.Unknown, "AWCC");
             ByteArrayOutputStream stm = new ByteArrayOutputStream();
             impl.encodeData(stm);
             byte[] encodedData = stm.toByteArray();
- assertTrue(Arrays.equals(encodedData, this.getDataAlphaNumeric()));
-    }
-}
+ assertTrue(Arrays.equals(encodedData, this.getDataAlphaNumeric_AWCC()));
+    }
+
+    @Test(groups = { "functional.decode", "smstpduAlphaNumeric" })
+    public void testDecodeAlphaNumericUfone() throws Exception {
+
+ InputStream stm = new ByteArrayInputStream(this.getDataAlphaNumeric_Ufone());
+            AddressFieldImpl impl = AddressFieldImpl.createMessage(stm);
+ assertEquals(impl.getTypeOfNumber(), TypeOfNumber.Alphanumeric); + assertEquals(impl.getNumberingPlanIdentification(), NumberingPlanIdentification.Unknown);
+            assertEquals(impl.getAddressValue(), "Ufone");
+    }
+
+    @Test(groups = { "functional.encode", "smstpduAlphaNumeric" })
+    public void testEncodeAlphaNumericUfone() throws Exception {
+
+ AddressFieldImpl impl = new AddressFieldImpl(TypeOfNumber.Alphanumeric, NumberingPlanIdentification.Unknown, "Ufone");
+            ByteArrayOutputStream stm = new ByteArrayOutputStream();
+            impl.encodeData(stm);
+            byte[] encodedData = stm.toByteArray();
+ assertTrue(Arrays.equals(encodedData, this.getDataAlphaNumeric_Ufone()));
+    }
+}

Reply via email to