From daec3ea92ea98bc177c1972393f1bd2f1f4958e1 Mon Sep 17 00:00:00 2001 From: halprin Date: Mon, 15 Jan 2024 15:46:50 -0700 Subject: [PATCH] 610: Handle when a null status comes back from the RS history API --- .../etor/metadata/PartnerMetadataOrchestrator.java | 4 ++++ .../etor/metadata/PartnerMetadataOrchestratorTest.groovy | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/metadata/PartnerMetadataOrchestrator.java b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/metadata/PartnerMetadataOrchestrator.java index cb2331cbf..4878fd304 100644 --- a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/metadata/PartnerMetadataOrchestrator.java +++ b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/metadata/PartnerMetadataOrchestrator.java @@ -221,6 +221,10 @@ String[] getReceiverAndStatus(String responseBody) throws FormatterProcessingExc } PartnerMetadataStatus ourStatusFromReportStreamStatus(String rsStatus) { + if (rsStatus == null) { + return PartnerMetadataStatus.PENDING; + } + return switch (rsStatus) { case "Error", "Not Delivering" -> PartnerMetadataStatus.FAILED; case "Delivered" -> PartnerMetadataStatus.DELIVERED; diff --git a/etor/src/test/groovy/gov/hhs/cdc/trustedintermediary/etor/metadata/PartnerMetadataOrchestratorTest.groovy b/etor/src/test/groovy/gov/hhs/cdc/trustedintermediary/etor/metadata/PartnerMetadataOrchestratorTest.groovy index b400fd3ac..5c0af8931 100644 --- a/etor/src/test/groovy/gov/hhs/cdc/trustedintermediary/etor/metadata/PartnerMetadataOrchestratorTest.groovy +++ b/etor/src/test/groovy/gov/hhs/cdc/trustedintermediary/etor/metadata/PartnerMetadataOrchestratorTest.groovy @@ -462,5 +462,11 @@ class PartnerMetadataOrchestratorTest extends Specification { then: ourStatus == PartnerMetadataStatus.PENDING + + when: + ourStatus = PartnerMetadataOrchestrator.getInstance().ourStatusFromReportStreamStatus(null) + + then: + ourStatus == PartnerMetadataStatus.PENDING } }