From 326fda0bc7e831028c2626ce91cea97f6d11d1e2 Mon Sep 17 00:00:00 2001 From: Basilio Bogado <541149+basiliskus@users.noreply.github.com> Date: Fri, 1 Nov 2024 14:59:48 -0700 Subject: [PATCH 1/5] Bubble up exceptions, add context, and let test fail --- .../external/hapi/HapiHL7FileMatcher.java | 20 +++++++++---------- .../hapi/HapiHL7FileMatcherTest.groovy | 15 +++++++------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcher.java b/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcher.java index b9151a1e4..7d0014fde 100644 --- a/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcher.java +++ b/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcher.java @@ -35,7 +35,8 @@ public static HapiHL7FileMatcher getInstance() { } public Map matchFiles( - List outputFiles, List inputFiles) { + List outputFiles, List inputFiles) + throws HL7Exception, IOException { // We pair up output and input files based on the control ID, which is in MSH-10 // Any files (either input or output) that don't have a match are logged Map inputMap = mapMessageByControlId(inputFiles); @@ -67,7 +68,8 @@ public Map matchFiles( return messageMap; } - public Map mapMessageByControlId(List files) { + public Map mapMessageByControlId(List files) + throws HL7Exception, IOException { Map messageMap = new HashMap<>(); @@ -75,25 +77,23 @@ public Map mapMessageByControlId(List files) { Parser parser = context.getPipeParser(); for (HL7FileStream hl7FileStream : files) { + String fileName = hl7FileStream.fileName(); try (InputStream inputStream = hl7FileStream.inputStream()) { String content = new String(inputStream.readAllBytes(), StandardCharsets.UTF_8); Message message = parser.parse(content); MSH mshSegment = (MSH) message.get("MSH"); String msh10 = mshSegment.getMessageControlID().getValue(); if (msh10 == null || msh10.isEmpty()) { - logger.logError("MSH-10 is empty for : " + hl7FileStream.fileName()); - continue; + throw new IllegalArgumentException( + String.format("MSH-10 is empty for file: %s", fileName)); } messageMap.put(msh10, message); - } catch (IOException | HL7Exception e) { - logger.logError( - "An error occurred while parsing the message: " - + hl7FileStream.fileName(), + } catch (HL7Exception e) { + throw new HL7Exception( + String.format("Failed to parse HL7 message from file: %s", fileName), e); } } - } catch (IOException e) { - logger.logError("An error occurred while constructing the DefaultHapiContext", e); } return messageMap; diff --git a/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcherTest.groovy b/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcherTest.groovy index 889038a18..0e38cf13f 100644 --- a/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcherTest.groovy +++ b/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcherTest.groovy @@ -1,6 +1,7 @@ package gov.hhs.cdc.trustedintermediary.rse2e.external.hapi import ca.uhn.hl7v2.model.Message +import ca.uhn.hl7v2.HL7Exception import gov.hhs.cdc.trustedintermediary.context.TestApplicationContext import gov.hhs.cdc.trustedintermediary.rse2e.HL7FileStream import gov.hhs.cdc.trustedintermediary.wrappers.Logger @@ -70,7 +71,7 @@ class HapiHL7FileMatcherTest extends Specification { file2MshSegment == result[file2Msh10].encode().trim() } - def "should log an error and continue when MSH-10 is empty"() { + def "should throw IllegalArgumentException when MSH-10 is empty"() { given: def msh1to9 = "MSH|^~\\&|Sender Application^sender.test.com^DNS|Sender Facility^0.0.0.0.0.0.0.0^ISO|Receiver Application^0.0.0.0.0.0.0.0^ISO|Receiver Facility^simulated-lab-id^DNS|20230101010000-0000||ORM^O01^ORM_O01|" def msh11to12 = "|T|2.5.1" @@ -80,23 +81,21 @@ class HapiHL7FileMatcherTest extends Specification { def hl7FileStream = new HL7FileStream("file1", inputStream) when: - def result = fileMatcher.mapMessageByControlId([hl7FileStream]) + fileMatcher.mapMessageByControlId([hl7FileStream]) then: - result.size() == 0 - 1 * mockLogger.logError({ it.contains("MSH-10 is empty") }) + thrown(IllegalArgumentException) } - def "should log an error when not able to parse the file as HL7 message"() { + def "should throw HL7Exception when not able to parse the file as HL7 message"() { given: def inputStream = new ByteArrayInputStream("".bytes) def hl7FileStream = new HL7FileStream("badFile", inputStream) when: - def result = fileMatcher.mapMessageByControlId([hl7FileStream]) + fileMatcher.mapMessageByControlId([hl7FileStream]) then: - result.size() == 0 - 1 * mockLogger.logError({ it.contains("An error occurred while parsing the message") }, _ as Exception) + thrown(HL7Exception) } } From 353c71f017d38bfd904c2732f2e5aeab75d19642 Mon Sep 17 00:00:00 2001 From: Basilio Bogado <541149+basiliskus@users.noreply.github.com> Date: Fri, 1 Nov 2024 15:40:57 -0700 Subject: [PATCH 2/5] Throw exception when no matching files found and simplify logic --- .../external/hapi/HapiHL7FileMatcher.java | 34 ++++++------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcher.java b/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcher.java index 7d0014fde..0b7c76cec 100644 --- a/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcher.java +++ b/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcher.java @@ -6,8 +6,8 @@ import ca.uhn.hl7v2.model.Message; import ca.uhn.hl7v2.model.v251.segment.MSH; import ca.uhn.hl7v2.parser.Parser; +import com.google.common.collect.Sets; import gov.hhs.cdc.trustedintermediary.rse2e.HL7FileStream; -import gov.hhs.cdc.trustedintermediary.wrappers.Logger; import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; @@ -15,8 +15,9 @@ import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.NoSuchElementException; import java.util.Set; -import javax.inject.Inject; +import java.util.stream.Collectors; /** * The HapiHL7FileMatcher class is responsible for matching input and output HL7 files based on the @@ -26,8 +27,6 @@ public class HapiHL7FileMatcher { private static final HapiHL7FileMatcher INSTANCE = new HapiHL7FileMatcher(); - @Inject Logger logger; - private HapiHL7FileMatcher() {} public static HapiHL7FileMatcher getInstance() { @@ -42,30 +41,19 @@ public Map matchFiles( Map inputMap = mapMessageByControlId(inputFiles); Map outputMap = mapMessageByControlId(outputFiles); - Set unmatchedInputKeys = new HashSet<>(inputMap.keySet()); - unmatchedInputKeys.removeAll(outputMap.keySet()); - - Set unmatchedOutputKeys = new HashSet<>(outputMap.keySet()); - unmatchedOutputKeys.removeAll(inputMap.keySet()); - + Set inputKeys = inputMap.keySet(); + Set outputKeys = outputMap.keySet(); Set unmatchedKeys = new HashSet<>(); - unmatchedKeys.addAll(unmatchedInputKeys); - unmatchedKeys.addAll(unmatchedOutputKeys); + unmatchedKeys.addAll(Sets.difference(inputKeys, outputKeys)); // in input but not output + unmatchedKeys.addAll(Sets.difference(outputKeys, inputKeys)); // in output but not input if (!unmatchedKeys.isEmpty()) { - logger.logError( - "Found no match for the following messages with MSH-10: " + unmatchedKeys); + throw new NoSuchElementException( + "Found no match for messages with the following MSH-10 values: " + + unmatchedKeys); } - Map messageMap = new HashMap<>(); - inputMap.keySet().retainAll(outputMap.keySet()); - inputMap.forEach( - (key, inputMessage) -> { - Message outputMessage = outputMap.get(key); - messageMap.put(inputMessage, outputMessage); - }); - - return messageMap; + return inputKeys.stream().collect(Collectors.toMap(inputMap::get, outputMap::get)); } public Map mapMessageByControlId(List files) From f29212285c79fbb8570fbec17feb59b15ba8bfd8 Mon Sep 17 00:00:00 2001 From: Basilio Bogado <541149+basiliskus@users.noreply.github.com> Date: Mon, 4 Nov 2024 09:20:42 -0800 Subject: [PATCH 3/5] Fixed failing test --- .../rse2e/external/hapi/HapiHL7FileMatcher.java | 4 ++-- .../rse2e/external/hapi/HapiHL7FileMatcherTest.groovy | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcher.java b/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcher.java index 0b7c76cec..4859b8a8c 100644 --- a/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcher.java +++ b/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcher.java @@ -44,8 +44,8 @@ public Map matchFiles( Set inputKeys = inputMap.keySet(); Set outputKeys = outputMap.keySet(); Set unmatchedKeys = new HashSet<>(); - unmatchedKeys.addAll(Sets.difference(inputKeys, outputKeys)); // in input but not output - unmatchedKeys.addAll(Sets.difference(outputKeys, inputKeys)); // in output but not input + unmatchedKeys.addAll(Sets.difference(inputKeys, outputKeys)); + unmatchedKeys.addAll(Sets.difference(outputKeys, inputKeys)); if (!unmatchedKeys.isEmpty()) { throw new NoSuchElementException( diff --git a/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcherTest.groovy b/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcherTest.groovy index 0e38cf13f..318d70db2 100644 --- a/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcherTest.groovy +++ b/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcherTest.groovy @@ -35,12 +35,15 @@ class HapiHL7FileMatcherTest extends Specification { spyFileMatcher.mapMessageByControlId(mockOutputFiles) >> [ "2": mockOutputMessage2, "3": Mock(Message) ] when: - def result = spyFileMatcher.matchFiles(mockOutputFiles, mockInputFiles) + spyFileMatcher.matchFiles(mockOutputFiles, mockInputFiles) then: - result.size() == 1 - result == Map.of(mockInputMessage2, mockOutputMessage2) - 1 * mockLogger.logError({ it.contains("Found no match") && it.contains("1") && it.contains("3") }) + def exception = thrown(NoSuchElementException) + with(exception.getMessage()) { + contains("Found no match") + contains("1") + contains("3") + } } def "should map message by control ID"() { From 1b16688bc70fcbf93875443632f04c97c9b1b0be Mon Sep 17 00:00:00 2001 From: Basilio Bogado <541149+basiliskus@users.noreply.github.com> Date: Mon, 4 Nov 2024 10:08:14 -0800 Subject: [PATCH 4/5] Added HapiHL7FileMatcherException custom exception and fixed tests --- .../external/hapi/HapiHL7FileMatcher.java | 16 ++-- .../hapi/HapiHL7FileMatcherException.java | 12 +++ .../HapiHL7FileMatcherExceptionTest.groovy | 30 +++++++ .../hapi/HapiHL7FileMatcherTest.groovy | 80 +++++++++++++++---- 4 files changed, 115 insertions(+), 23 deletions(-) create mode 100644 rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcherException.java create mode 100644 rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcherExceptionTest.groovy diff --git a/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcher.java b/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcher.java index 4859b8a8c..4ab050ef2 100644 --- a/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcher.java +++ b/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcher.java @@ -15,7 +15,6 @@ import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.NoSuchElementException; import java.util.Set; import java.util.stream.Collectors; @@ -35,7 +34,7 @@ public static HapiHL7FileMatcher getInstance() { public Map matchFiles( List outputFiles, List inputFiles) - throws HL7Exception, IOException { + throws HapiHL7FileMatcherException { // We pair up output and input files based on the control ID, which is in MSH-10 // Any files (either input or output) that don't have a match are logged Map inputMap = mapMessageByControlId(inputFiles); @@ -48,7 +47,7 @@ public Map matchFiles( unmatchedKeys.addAll(Sets.difference(outputKeys, inputKeys)); if (!unmatchedKeys.isEmpty()) { - throw new NoSuchElementException( + throw new HapiHL7FileMatcherException( "Found no match for messages with the following MSH-10 values: " + unmatchedKeys); } @@ -57,7 +56,7 @@ public Map matchFiles( } public Map mapMessageByControlId(List files) - throws HL7Exception, IOException { + throws HapiHL7FileMatcherException { Map messageMap = new HashMap<>(); @@ -72,16 +71,21 @@ public Map mapMessageByControlId(List files) MSH mshSegment = (MSH) message.get("MSH"); String msh10 = mshSegment.getMessageControlID().getValue(); if (msh10 == null || msh10.isEmpty()) { - throw new IllegalArgumentException( + throw new HapiHL7FileMatcherException( String.format("MSH-10 is empty for file: %s", fileName)); } messageMap.put(msh10, message); } catch (HL7Exception e) { - throw new HL7Exception( + throw new HapiHL7FileMatcherException( String.format("Failed to parse HL7 message from file: %s", fileName), e); + } catch (IOException e) { + throw new HapiHL7FileMatcherException( + String.format("Failed to read file: %s", fileName), e); } } + } catch (IOException e) { + throw new HapiHL7FileMatcherException("Failed to close input stream", e); } return messageMap; diff --git a/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcherException.java b/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcherException.java new file mode 100644 index 000000000..6e710f101 --- /dev/null +++ b/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcherException.java @@ -0,0 +1,12 @@ +package gov.hhs.cdc.trustedintermediary.rse2e.external.hapi; + +public class HapiHL7FileMatcherException extends Exception { + + public HapiHL7FileMatcherException(String message, Throwable cause) { + super(message, cause); + } + + public HapiHL7FileMatcherException(String message) { + super(message); + } +} diff --git a/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcherExceptionTest.groovy b/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcherExceptionTest.groovy new file mode 100644 index 000000000..07e65529e --- /dev/null +++ b/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcherExceptionTest.groovy @@ -0,0 +1,30 @@ +package gov.hhs.cdc.trustedintermediary.rse2e.external.hapi + +import spock.lang.Specification + +class HapiHL7FileMatcherExceptionTest extends Specification { + + def "two param constructor works"() { + given: + def message = "something blew up!" + def cause = new NullPointerException() + + when: + def exception = new HapiHL7FileMatcherException(message, cause) + + then: + exception.getMessage() == message + exception.getCause() == cause + } + + def "single param constructor works"() { + given: + def message = "something blew up!" + + when: + def exception = new HapiHL7FileMatcherException(message) + + then: + exception.getMessage() == message + } +} diff --git a/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcherTest.groovy b/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcherTest.groovy index 318d70db2..8e0f98c20 100644 --- a/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcherTest.groovy +++ b/rs-e2e/src/test/groovy/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcherTest.groovy @@ -1,7 +1,6 @@ package gov.hhs.cdc.trustedintermediary.rse2e.external.hapi import ca.uhn.hl7v2.model.Message -import ca.uhn.hl7v2.HL7Exception import gov.hhs.cdc.trustedintermediary.context.TestApplicationContext import gov.hhs.cdc.trustedintermediary.rse2e.HL7FileStream import gov.hhs.cdc.trustedintermediary.wrappers.Logger @@ -21,28 +20,75 @@ class HapiHL7FileMatcherTest extends Specification { TestApplicationContext.injectRegisteredImplementations() } - def "should correctly match input and output files and log unmatched files"() { + def "should correctly match input and output files"() { given: def spyFileMatcher = Spy(HapiHL7FileMatcher.getInstance()) - def fileStream1 = new HL7FileStream("file1", Mock(InputStream)) - def fileStream2 = new HL7FileStream("file2", Mock(InputStream)) - def fileStream3 = new HL7FileStream("file3", Mock(InputStream)) - def mockInputFiles = [fileStream1, fileStream2] - def mockOutputFiles = [fileStream2, fileStream3] + def mockInputFiles = [ + new HL7FileStream("inputFileStream1", Mock(InputStream)), + new HL7FileStream("inputFileStream2", Mock(InputStream)) + ] + def mockOutputFiles = [ + new HL7FileStream("outputFileStream1", Mock(InputStream)), + new HL7FileStream("outputFileStream2", Mock(InputStream)) + ] + def mockInputMessage1 = Mock(Message) def mockInputMessage2 = Mock(Message) + def mockOutputMessage1 = Mock(Message) def mockOutputMessage2 = Mock(Message) - spyFileMatcher.mapMessageByControlId(mockInputFiles) >> [ "1": Mock(Message), "2": mockInputMessage2 ] - spyFileMatcher.mapMessageByControlId(mockOutputFiles) >> [ "2": mockOutputMessage2, "3": Mock(Message) ] + spyFileMatcher.mapMessageByControlId(mockInputFiles) >> [ "001": mockInputMessage1, "002": mockInputMessage2 ] + spyFileMatcher.mapMessageByControlId(mockOutputFiles) >> [ "001": mockOutputMessage1, "002": mockOutputMessage2 ] + + when: + def result =spyFileMatcher.matchFiles(mockOutputFiles, mockInputFiles) + + then: + result.size() == 2 + result == Map.of(mockInputMessage1, mockOutputMessage1, mockInputMessage2, mockOutputMessage2) + } + + + def "should throw HapiHL7FileMatcherException if didn't find a match for at least one file in either input or output"() { + given: + def mockInputFiles + def mockOutputFiles + def spyFileMatcher = Spy(HapiHL7FileMatcher.getInstance()) when: + mockInputFiles = [ + new HL7FileStream("nonMatchingInputFileStream", Mock(InputStream)), + new HL7FileStream("matchingInputFileStream", Mock(InputStream)) + ] + mockOutputFiles = [ + new HL7FileStream("matchingOutputFileStream", Mock(InputStream)) + ] + spyFileMatcher.mapMessageByControlId(mockInputFiles) >> [ "001": Mock(Message), "002": Mock(Message) ] + spyFileMatcher.mapMessageByControlId(mockOutputFiles) >> [ "001": Mock(Message) ] + spyFileMatcher.matchFiles(mockOutputFiles, mockInputFiles) + + then: + def nonMatchingInputException = thrown(HapiHL7FileMatcherException) + with(nonMatchingInputException.getMessage()) { + contains("Found no match") + contains("002") + } + + when: + mockInputFiles = [ + new HL7FileStream("matchingInputFileStream", Mock(InputStream)) + ] + mockOutputFiles = [ + new HL7FileStream("matchingOutputFileStream", Mock(InputStream)), + new HL7FileStream("nonMatchingOutputFileStream", Mock(InputStream)) + ] + spyFileMatcher.mapMessageByControlId(mockInputFiles) >> [ "001": Mock(Message) ] + spyFileMatcher.mapMessageByControlId(mockOutputFiles) >> [ "001": Mock(Message), "003": Mock(Message) ] spyFileMatcher.matchFiles(mockOutputFiles, mockInputFiles) then: - def exception = thrown(NoSuchElementException) - with(exception.getMessage()) { + def nonMatchingOutputException = thrown(HapiHL7FileMatcherException) + with(nonMatchingOutputException.getMessage()) { contains("Found no match") - contains("1") - contains("3") + contains("003") } } @@ -74,7 +120,7 @@ class HapiHL7FileMatcherTest extends Specification { file2MshSegment == result[file2Msh10].encode().trim() } - def "should throw IllegalArgumentException when MSH-10 is empty"() { + def "should throw HapiHL7FileMatcherException when MSH-10 is empty"() { given: def msh1to9 = "MSH|^~\\&|Sender Application^sender.test.com^DNS|Sender Facility^0.0.0.0.0.0.0.0^ISO|Receiver Application^0.0.0.0.0.0.0.0^ISO|Receiver Facility^simulated-lab-id^DNS|20230101010000-0000||ORM^O01^ORM_O01|" def msh11to12 = "|T|2.5.1" @@ -87,10 +133,10 @@ class HapiHL7FileMatcherTest extends Specification { fileMatcher.mapMessageByControlId([hl7FileStream]) then: - thrown(IllegalArgumentException) + thrown(HapiHL7FileMatcherException) } - def "should throw HL7Exception when not able to parse the file as HL7 message"() { + def "should throw HapiHL7FileMatcherException when not able to parse the file as HL7 message"() { given: def inputStream = new ByteArrayInputStream("".bytes) def hl7FileStream = new HL7FileStream("badFile", inputStream) @@ -99,6 +145,6 @@ class HapiHL7FileMatcherTest extends Specification { fileMatcher.mapMessageByControlId([hl7FileStream]) then: - thrown(HL7Exception) + thrown(HapiHL7FileMatcherException) } } From 694e44739a3cacf2cb860cd99fa96ecec80510e5 Mon Sep 17 00:00:00 2001 From: Basilio Bogado <541149+basiliskus@users.noreply.github.com> Date: Mon, 4 Nov 2024 10:15:16 -0800 Subject: [PATCH 5/5] Added javadocs --- .../rse2e/external/hapi/HapiHL7FileMatcherException.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcherException.java b/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcherException.java index 6e710f101..fc3e0956d 100644 --- a/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcherException.java +++ b/rs-e2e/src/main/java/gov/hhs/cdc/trustedintermediary/rse2e/external/hapi/HapiHL7FileMatcherException.java @@ -1,5 +1,9 @@ package gov.hhs.cdc.trustedintermediary.rse2e.external.hapi; +/** + * The HapiHL7FileMatcherException class is responsible for handling exceptions that occur in the + * HapiHL7FileMatcher class. + */ public class HapiHL7FileMatcherException extends Exception { public HapiHL7FileMatcherException(String message, Throwable cause) {