From 536221cb608a123ba03aeb85896dc7ff5d78f583 Mon Sep 17 00:00:00 2001 From: Alejandro Revilla Date: Tue, 17 Oct 2017 20:44:38 -0300 Subject: [PATCH] properly deal with headers in response messages If the expected result does not specify a header, and the actual response message comes with a header, we set it to null before comparing. --- .../java/org/jpos/simulator/TestRunner.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/client-simulator/src/main/java/org/jpos/simulator/TestRunner.java b/modules/client-simulator/src/main/java/org/jpos/simulator/TestRunner.java index d4db167126..0875a0b6b7 100644 --- a/modules/client-simulator/src/main/java/org/jpos/simulator/TestRunner.java +++ b/modules/client-simulator/src/main/java/org/jpos/simulator/TestRunner.java @@ -21,20 +21,13 @@ import java.io.File; import java.io.IOException; import java.io.FileInputStream; -import java.util.Iterator; -import java.util.List; -import java.util.ArrayList; -import org.jpos.iso.ISOMsg; -import org.jpos.iso.ISOComponent; -import org.jpos.iso.ISOUtil; -import org.jpos.iso.ISOField; -import org.jpos.iso.ISOPackager; -import org.jpos.iso.ISOException; +import java.util.*; + +import org.jpos.iso.*; import org.jpos.iso.packager.XMLPackager; import org.jpos.util.Logger; import org.jpos.util.LogEvent; import org.jdom2.Element; -import org.jpos.iso.MUX; import org.jpos.util.NameRegistrar; import bsh.Interpreter; import bsh.BshClassManager; @@ -306,7 +299,14 @@ private boolean assertResponse (TestCase tc, Interpreter bsh, LogEvent evt) } } } - if (!(new String(c.pack())).equals(new String(expected.pack()))) { + if (expected.getHeader() == null) + c.setHeader((byte[]) null); + if (!Arrays.equals(c.pack(), expected.pack())) { + evt.addMessage("Pack mismatch"); + evt.addMessage("--- expected ---"); + evt.addMessage(ISOUtil.hexdump (expected.pack())); + evt.addMessage("--- actual ---"); + evt.addMessage(ISOUtil.hexdump (c.pack())); tc.setResultCode (TestCase.FAILURE); return false; }