Skip to content

Commit

Permalink
Fixed remaining test
Browse files Browse the repository at this point in the history
  • Loading branch information
basiliskus committed Dec 23, 2024
1 parent eaadd34 commit e74266f
Showing 1 changed file with 16 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"() {
Expand Down

0 comments on commit e74266f

Please sign in to comment.