generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed tests, added test coverage and some more refactoring
- Loading branch information
1 parent
d34f1ba
commit 38556b6
Showing
6 changed files
with
98 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/hl7/HL7EncodingTest.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package gov.hhs.cdc.trustedintermediary.rse2e.hl7 | ||
|
||
import spock.lang.Specification | ||
|
||
class HL7EncodingTest extends Specification { | ||
|
||
def "defaultEncoding should use expected default characters"() { | ||
when: | ||
def encodingChars = HL7Encoding.defaultEncoding() | ||
|
||
then: | ||
encodingChars.getFieldDelimiter() == '|' as char | ||
encodingChars.getComponentDelimiter() == '^' as char | ||
encodingChars.getRepetitionDelimiter() == '~' as char | ||
encodingChars.getEscapeCharacter() == '\\' as char | ||
encodingChars.getSubcomponentDelimiter() == '&' as char | ||
} | ||
|
||
def "fromEncodingField should use custom encoding characters when provided"() { | ||
given: | ||
def customEncodingChars = "@#+_" | ||
|
||
when: | ||
def encodingChars = HL7Encoding.fromEncodingField(customEncodingChars) | ||
|
||
then: | ||
encodingChars.getFieldDelimiter() == '|' as char | ||
encodingChars.getComponentDelimiter() == '@' as char | ||
encodingChars.getRepetitionDelimiter() == '#' as char | ||
encodingChars.getEscapeCharacter() == '+' as char | ||
encodingChars.getSubcomponentDelimiter() == '_' as char | ||
} | ||
|
||
def "fromEncodingField should use default characters when encoding characters passed is blank or null"() { | ||
when: | ||
def blankEncodingChars = HL7Encoding.fromEncodingField("") | ||
|
||
then: | ||
blankEncodingChars.getFieldDelimiter() == '|' as char | ||
blankEncodingChars.getComponentDelimiter() == '^' as char | ||
blankEncodingChars.getRepetitionDelimiter() == '~' as char | ||
blankEncodingChars.getEscapeCharacter() == '\\' as char | ||
blankEncodingChars.getSubcomponentDelimiter() == '&' as char | ||
|
||
when: | ||
def nullEncodingChars = HL7Encoding.fromEncodingField(null) | ||
|
||
then: | ||
nullEncodingChars.getFieldDelimiter() == '|' as char | ||
nullEncodingChars.getComponentDelimiter() == '^' as char | ||
nullEncodingChars.getRepetitionDelimiter() == '~' as char | ||
nullEncodingChars.getEscapeCharacter() == '\\' as char | ||
nullEncodingChars.getSubcomponentDelimiter() == '&' as char | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters