From e74266f696d698d72272cc16b9753d705f4af9eb Mon Sep 17 00:00:00 2001 From: Basilio Bogado <541149+basiliskus@users.noreply.github.com> Date: Mon, 23 Dec 2024 08:44:15 -0800 Subject: [PATCH] Fixed remaining test --- .../rse2e/hl7/HL7ParserTest.groovy | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/hl7/HL7ParserTest.groovy b/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/hl7/HL7ParserTest.groovy index 2bcef6543..503663efa 100644 --- a/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/hl7/HL7ParserTest.groovy +++ b/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/hl7/HL7ParserTest.groovy @@ -70,15 +70,9 @@ PID|||12345""" "invalid index" | "TST-5" | "" } - def "parseMessageFieldValue returns an exception when either or both inputs are null"() { + def "parseMessageFieldValue returns an exception when hl7 path argument is empty or null"() { when: - HL7Parser.parseMessageFieldValue(null, null) - - then: - thrown(HL7ParserException) - - when: - def hl7Path = HL7Parser.parsePath("MSH-3") + def hl7Path = HL7Parser.parsePath("") HL7Parser.parseMessageFieldValue(null, hl7Path) then: @@ -92,27 +86,31 @@ PID|||12345""" thrown(HL7ParserException) } - def "parseMessageFieldValue returns an empty string if an empty message is given"() { - given: - def hl7Path = HL7Parser.parsePath("MSH-3") - def message = HL7Parser.parseMessage("") + def "parseMessageFieldValue returns an exception when message argument is null"() { + when: + HL7Parser.parseMessageFieldValue(null, null) + + then: + thrown(HL7ParserException) when: - def out = HL7Parser.parseMessageFieldValue(message, hl7Path) + def hl7Path = HL7Parser.parsePath("MSH-3") + HL7Parser.parseMessageFieldValue(null, hl7Path) then: - out == "" + thrown(HL7ParserException) } - def "parseMessageFieldValue returns an empty string if an empty hl7 path is given"() { + def "parseMessageFieldValue returns an exception when message argument is empty"() { given: - def hl7Path = HL7Parser.parsePath("") + def hl7Path = HL7Parser.parsePath("MSH-3") + def message = HL7Parser.parseMessage("") when: - def out = HL7Parser.parseMessageFieldValue(_ as HL7Message, hl7Path) + def out = HL7Parser.parseMessageFieldValue(message, hl7Path) then: - out == "" + thrown(HL7MessageException) } def "parseMessageFieldValue returns an empty string if the indices in hl7 path are pointing outside the expected range"() {