Repository navigation
Conversation
…reader, and extend DigestAuthenticator tests Add comprehensive JUnit tests covering parsing and validation behavior: - ER7ReaderTest: verifies HL7v2 ER7 parsing (headers, segments, empty fields/components, repetitions, subcomponents, custom encodings, batch headers, whitespace handling, error conditions). - HL7v2ResponseValidatorTest: exercises ACK/NACK validation logic, control ID matching (including map/channel variable sources), custom ACK codes, XML-encoded messages, line break handling and DOCTYPE rejection. - NCPDPReaderTest: exercises NCPDP D0/51 parsing (headers, transactions/groups, count/counter fields, version-dependent field names, unknown fields, and error conditions). - DigestAuthenticatorTest: expand HTTP Digest auth tests to cover challenge generation, qop/algorithm variations (MD5, MD5-sess, auth-int), nonce/nc handling, replay and stale behavior, malformed directives, and edge cases. These tests increase coverage for parsers and authentication logic and codify expected behaviors and edge cases. Signed-off-by: Nico Piel <nico.piel@hotmail.de>
28cde17 to
7a34890
Compare
Signed-off-by: Mitch Gaffigan <mitch.gaffigan@comcast.net> (cherry picked from commit 4be641b)
Signed-off-by: Mitch Gaffigan <mitch.gaffigan@comcast.net> (cherry picked from commit 37167db)
Signed-off-by: Mitch Gaffigan <mitch.gaffigan@comcast.net> (cherry picked from commit 9cd87c0)
Signed-off-by: Mitch Gaffigan <mitch.gaffigan@comcast.net> (cherry picked from commit a92bb88)
Signed-off-by: Mitch Gaffigan <mitch.gaffigan@comcast.net> (cherry picked from commit 3ea4b26)
The HL7 batch and NCPDP request/response fixtures already pin the headers and segment layout these tests asserted. testTransactionGroups stays, since every fixture carries a single transaction. Signed-off-by: Nico Piel <nico.piel@hotmail.de>
I'll try and do that. |
Review notesOverall this is a net gain. Coverage goes up, the restored tests are real tests now, and nothing that used to run was lost. There's one test failure to look at and a few fixture items. Renames, deletions, coverage
Should fix
Worth discussing
Nits
ProvenanceThe five cherry-picks match #449 except for the |
|
The TemplateValueReplacerTest thing sounds similar to #519. The NCPDP thing should stay binary - they only casually look like text. Line endings do not have semantic meaning in an NCPDP file and would corrupt things. They also contain control characters that may anger terminals when diff is run. Unless a DICOM expert can tell me the pixel data is useless I would recommend leaving it. 2.6MB is negligible and ensures we don't have to later add samples that do have pixel data. It also avoids creating a derive work of the NCI dataset - though they may be available without the pixel data - not sure. |
Adds unit tests for the HL7v2 and NCPDP readers, the HL7v2 response validator and the digest authenticator, and brings over the data type tests from #449 so they can land sooner.
New unit tests
What the tests cover:
authandauth-int, plus stale nonces, replayed and too-high nonce counts, and each invalid-directive path.ER7ReaderER7ReaderTest.java(new)NCPDPReaderNCPDPReaderTest.java(new)HL7v2ResponseValidatorHL7v2ResponseValidatorTest.java(new)DigestAuthenticatorDigestAuthenticatorTest.java(15 tests added)Data type tests from #449
Cherry-picked from @mgaffigan's
maint/restore-testswith-x, authorship and sign-off kept:*Tests(HL7 serializer, password and value replacer tests renamed to*Testso the build picks them up)main()-style test entrypointsThese sample-message tests pin realistic round trips, including the XML-to-message direction. The reader tests above cover edge cases the samples don't reach. Four reader tests that only repeated what the fixtures already check were dropped in the last commit.
testTransactionGroupsstays, because every NCPDP fixture has a single transaction.142 data type, digest, password and value-replacer tests pass locally on JDK 17.