Test parsing binary numbers

This commit is contained in:
Enrique Zamudio
2012-11-30 12:25:42 -06:00
parent 7c5be782db
commit 8544f0e38c
+10
View File
@@ -4,6 +4,9 @@ import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.text.ParseException;
import com.solab.iso8583.IsoValue;
import com.solab.iso8583.parse.NumericParseInfo;
import junit.framework.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -96,4 +99,11 @@ public class TestParsing {
mf.parseMessage(new byte[]{2, 0x10, (byte)0xB2, 0x3A, (byte)0x80, 1, 0x2E, (byte)0xA0, (byte)0x80, 0x18, 0, 0, 0, 0, 0x14, 0, 0, 4, 0x65, 0, 0, 0, 0, 0, 0, 0x30, 0, 0x04, 0x28, 0x13, 0x05, 0x47, 0x46, (byte)0x87, 0x71, 0x12, 0x59, 0x46, 0x04, 0x28, 0x04, 0x28, 0x08, 0x11, 0x05, 0x12, 0x34}, 0);
}
@Test
public void testBinaryNumberParsing() throws ParseException {
NumericParseInfo npi = new NumericParseInfo(6);
IsoValue<Number> val = npi.parseBinary(new byte[]{0x12, 0x34, 0x56}, 0, null);
Assert.assertEquals(123456, val.getValue().intValue());
}
}