tests for #14
This commit is contained in:
@@ -1,12 +1,14 @@
|
|||||||
package j8583;
|
package j8583;
|
||||||
|
|
||||||
import com.solab.iso8583.IsoMessage;
|
import com.solab.iso8583.IsoMessage;
|
||||||
|
import com.solab.iso8583.IsoType;
|
||||||
import com.solab.iso8583.IsoValue;
|
import com.solab.iso8583.IsoValue;
|
||||||
import com.solab.iso8583.MessageFactory;
|
import com.solab.iso8583.MessageFactory;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.text.ParseException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test certain ConfigParser features.
|
* Test certain ConfigParser features.
|
||||||
@@ -17,7 +19,7 @@ import java.io.IOException;
|
|||||||
public class TestConfigParser {
|
public class TestConfigParser {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParser() throws IOException {
|
public void testParser() throws IOException, ParseException {
|
||||||
MessageFactory<IsoMessage> mfact = new MessageFactory<IsoMessage>();
|
MessageFactory<IsoMessage> mfact = new MessageFactory<IsoMessage>();
|
||||||
mfact.setConfigPath("config.xml");
|
mfact.setConfigPath("config.xml");
|
||||||
//Headers
|
//Headers
|
||||||
@@ -42,6 +44,22 @@ public class TestConfigParser {
|
|||||||
Assert.assertTrue(m400.hasField(90));
|
Assert.assertTrue(m400.hasField(90));
|
||||||
Assert.assertTrue(m200.hasField(102));
|
Assert.assertTrue(m200.hasField(102));
|
||||||
Assert.assertFalse(m400.hasField(102));
|
Assert.assertFalse(m400.hasField(102));
|
||||||
|
|
||||||
|
//Parsing guides
|
||||||
|
final String s800 = "0800201080000000000012345611251125";
|
||||||
|
final String s810 = "08102010000002000000123456112500";
|
||||||
|
IsoMessage m = mfact.parseMessage(s800.getBytes(), 0);
|
||||||
|
Assert.assertNotNull(m);
|
||||||
|
Assert.assertTrue(m.hasField(3));
|
||||||
|
Assert.assertTrue(m.hasField(12));
|
||||||
|
Assert.assertTrue(m.hasField(17));
|
||||||
|
Assert.assertFalse(m.hasField(39));
|
||||||
|
m = mfact.parseMessage(s810.getBytes(), 0);
|
||||||
|
Assert.assertNotNull(m);
|
||||||
|
Assert.assertTrue(m.hasField(3));
|
||||||
|
Assert.assertTrue(m.hasField(12));
|
||||||
|
Assert.assertFalse(m.hasField(17));
|
||||||
|
Assert.assertTrue(m.hasField(39));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,4 +121,15 @@
|
|||||||
<field num="102" type="LLLVAR" />
|
<field num="102" type="LLLVAR" />
|
||||||
</parse>
|
</parse>
|
||||||
|
|
||||||
|
<parse type="0800">
|
||||||
|
<field num="3" type="ALPHA" length="6">123456</field>
|
||||||
|
<field num="12" type="DATE4">1231</field>
|
||||||
|
<field num="17" type="DATE4">1231</field>
|
||||||
|
</parse>
|
||||||
|
|
||||||
|
<parse type="0810" extends="0800">
|
||||||
|
<field num="17" type="exclude"/>
|
||||||
|
<field num="39" type="ALPHA" length="2"/>
|
||||||
|
</parse>
|
||||||
|
|
||||||
</j8583-config>
|
</j8583-config>
|
||||||
|
|||||||
Reference in New Issue
Block a user