Skip to content

Commit

Permalink
properly deal with headers in response messages
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ar committed Oct 17, 2017
1 parent 79701ed commit 536221c
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 536221c

Please # to comment.