Re: [HAPI-devel] Comparing messages

2012-08-08 Thread James Agnew
Hi Derek, I don't believe that EncodedMessageComparator does, but you could always null it out in both the expected and actual message before you compare. Alternately, Hl7V2MessageCompare has a method "setFieldsToIgnore()" which lets you put in one or more terser paths to ignore. So you could do

Re: [HAPI-devel] Comparing messages

2012-08-08 Thread Derek Mahar
Does EncodedMessageComparator.equivalent() ignore the time stamp in the message header? http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/util/EncodedMessageComparator.html#equivalent(java.lang.String, java.lang.String) Derek On Wed, Aug 8, 2012 at 3:31 PM, christian ohr wrote: > > ... o

Re: [HAPI-devel] Comparing messages

2012-08-08 Thread christian ohr
... or there's ca.uhn.hl7v2.util.EncodedMessageComparator, which provides a couple of methods that help standardizing and comparing messages. cheers Christian rahul somasunderam-2 wrote: > > I wrote up a method using LightHL7Lib: > > public void assertMessagesEqual(Hl7Record expected, Hl7R

Re: [HAPI-devel] Comparing messages

2012-08-08 Thread James Agnew
Hi Derek, One other option is to use the Hl7V2MessageCompare class from the hapi-testpanel subproject. This should probably get moved to the main HAPI library at some point, so it's a bit annoying to import for now, but it's certainly very robust. We use it internally at UHN quite a bit. You can

Re: [HAPI-devel] Comparing messages

2012-08-08 Thread Rahul Somasunderam
I wrote up a method using LightHL7Lib: public void assertMessagesEqual(Hl7Record expected, Hl7Record actual) { List headers = expected.listSegments(); headers.addAll(actual.listSegments()); assertEquals(expected.listSegments(), actual.listSegments()); Set segments = new TreeSet(h

[HAPI-devel] Comparing messages

2012-08-08 Thread Derek Mahar
Is comparing the string representation of a HAPI message the only way to compare messages? We noticed that HAPI messages don't redefine method equals(), so comparisons using JUnit assertions or Mockito verify() calls must use Object.equals() which compares object identity, not contents. Are there