diff --git a/apps/bfd-server/bfd-server-war/src/main/java/gov/cms/bfd/server/war/stu3/providers/DMEClaimTransformer.java b/apps/bfd-server/bfd-server-war/src/main/java/gov/cms/bfd/server/war/stu3/providers/DMEClaimTransformer.java index c2534380fe..621389d25e 100644 --- a/apps/bfd-server/bfd-server-war/src/main/java/gov/cms/bfd/server/war/stu3/providers/DMEClaimTransformer.java +++ b/apps/bfd-server/bfd-server-war/src/main/java/gov/cms/bfd/server/war/stu3/providers/DMEClaimTransformer.java @@ -9,7 +9,6 @@ import gov.cms.bfd.model.codebook.data.CcwCodebookVariable; import gov.cms.bfd.model.rif.entities.DMEClaim; import gov.cms.bfd.model.rif.entities.DMEClaimLine; -import gov.cms.bfd.model.rif.samhsa.CarrierTag; import gov.cms.bfd.model.rif.samhsa.DmeTag; import gov.cms.bfd.server.war.commons.ClaimType; import gov.cms.bfd.server.war.commons.IdentifierType; @@ -43,8 +42,7 @@ final class DMEClaimTransformer implements ClaimTransformerInterface { MetricRegistry.name(DMEClaimTransformer.class.getSimpleName(), "transform"); /** Injecting lookUpSamhsaSecurityTags. */ - @Autowired - private LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags; + @Autowired private LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags; /** * Instantiates a new transformer. @@ -313,14 +311,14 @@ private ExplanationOfBenefit transformClaim(DMEClaim claimGroup, boolean include TransformerUtils.setLastUpdated(eob, claimGroup.getLastUpdated()); String securityTag = - lookUpSamhsaSecurityTags.getClaimSecurityLevel( - String.valueOf(claimGroup.getClaimId()), DmeTag.class); + lookUpSamhsaSecurityTags.getClaimSecurityLevel( + String.valueOf(claimGroup.getClaimId()), DmeTag.class); eob.getMeta() - .addSecurity() - .setSystem("https://terminology.hl7.org/6.1.0/CodeSystem-v3-Confidentiality.html") - .setCode(securityTag) - .setDisplay(securityTag); + .addSecurity() + .setSystem("https://terminology.hl7.org/6.1.0/CodeSystem-v3-Confidentiality.html") + .setCode(securityTag) + .setDisplay(securityTag); return eob; } } diff --git a/apps/bfd-server/bfd-server-war/src/main/java/gov/cms/bfd/server/war/stu3/providers/HHAClaimTransformer.java b/apps/bfd-server/bfd-server-war/src/main/java/gov/cms/bfd/server/war/stu3/providers/HHAClaimTransformer.java index 9a62fa08c5..4b00b9cde6 100644 --- a/apps/bfd-server/bfd-server-war/src/main/java/gov/cms/bfd/server/war/stu3/providers/HHAClaimTransformer.java +++ b/apps/bfd-server/bfd-server-war/src/main/java/gov/cms/bfd/server/war/stu3/providers/HHAClaimTransformer.java @@ -10,7 +10,6 @@ import gov.cms.bfd.model.rif.entities.HHAClaim; import gov.cms.bfd.model.rif.entities.HHAClaimLine; import gov.cms.bfd.model.rif.entities.OutpatientClaim; -import gov.cms.bfd.model.rif.samhsa.DmeTag; import gov.cms.bfd.model.rif.samhsa.HhaTag; import gov.cms.bfd.server.war.commons.ClaimType; import gov.cms.bfd.server.war.commons.LookUpSamhsaSecurityTags; @@ -42,8 +41,7 @@ final class HHAClaimTransformer implements ClaimTransformerInterface { MetricRegistry.name(HHAClaimTransformer.class.getSimpleName(), "transform"); /** Injecting lookUpSamhsaSecurityTags. */ - @Autowired - private LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags; + @Autowired private LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags; /** * Instantiates a new transformer. @@ -207,14 +205,14 @@ private ExplanationOfBenefit transformClaim(HHAClaim claimGroup) { TransformerUtils.setLastUpdated(eob, claimGroup.getLastUpdated()); String securityTag = - lookUpSamhsaSecurityTags.getClaimSecurityLevel( - String.valueOf(claimGroup.getClaimId()), HhaTag.class); + lookUpSamhsaSecurityTags.getClaimSecurityLevel( + String.valueOf(claimGroup.getClaimId()), HhaTag.class); eob.getMeta() - .addSecurity() - .setSystem("https://terminology.hl7.org/6.1.0/CodeSystem-v3-Confidentiality.html") - .setCode(securityTag) - .setDisplay(securityTag); + .addSecurity() + .setSystem("https://terminology.hl7.org/6.1.0/CodeSystem-v3-Confidentiality.html") + .setCode(securityTag) + .setDisplay(securityTag); return eob; } } diff --git a/apps/bfd-server/bfd-server-war/src/main/java/gov/cms/bfd/server/war/stu3/providers/HospiceClaimTransformer.java b/apps/bfd-server/bfd-server-war/src/main/java/gov/cms/bfd/server/war/stu3/providers/HospiceClaimTransformer.java index a21b9becb5..ed397cebc1 100644 --- a/apps/bfd-server/bfd-server-war/src/main/java/gov/cms/bfd/server/war/stu3/providers/HospiceClaimTransformer.java +++ b/apps/bfd-server/bfd-server-war/src/main/java/gov/cms/bfd/server/war/stu3/providers/HospiceClaimTransformer.java @@ -9,7 +9,6 @@ import gov.cms.bfd.model.codebook.data.CcwCodebookVariable; import gov.cms.bfd.model.rif.entities.HospiceClaim; import gov.cms.bfd.model.rif.entities.HospiceClaimLine; -import gov.cms.bfd.model.rif.samhsa.HhaTag; import gov.cms.bfd.model.rif.samhsa.HospiceTag; import gov.cms.bfd.server.war.commons.ClaimType; import gov.cms.bfd.server.war.commons.LookUpSamhsaSecurityTags; @@ -40,8 +39,7 @@ final class HospiceClaimTransformer implements ClaimTransformerInterface { MetricRegistry.name(HospiceClaimTransformer.class.getSimpleName(), "transform"); /** Injecting lookUpSamhsaSecurityTags. */ - @Autowired - private LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags; + @Autowired private LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags; /** * Instantiates a new transformer. @@ -207,14 +205,14 @@ private ExplanationOfBenefit transformClaim(HospiceClaim claimGroup) { TransformerUtils.setLastUpdated(eob, claimGroup.getLastUpdated()); String securityTag = - lookUpSamhsaSecurityTags.getClaimSecurityLevel( - String.valueOf(claimGroup.getClaimId()), HospiceTag.class); + lookUpSamhsaSecurityTags.getClaimSecurityLevel( + String.valueOf(claimGroup.getClaimId()), HospiceTag.class); eob.getMeta() - .addSecurity() - .setSystem("https://terminology.hl7.org/6.1.0/CodeSystem-v3-Confidentiality.html") - .setCode(securityTag) - .setDisplay(securityTag); + .addSecurity() + .setSystem("https://terminology.hl7.org/6.1.0/CodeSystem-v3-Confidentiality.html") + .setCode(securityTag) + .setDisplay(securityTag); return eob; } } diff --git a/apps/bfd-server/bfd-server-war/src/main/java/gov/cms/bfd/server/war/stu3/providers/InpatientClaimTransformer.java b/apps/bfd-server/bfd-server-war/src/main/java/gov/cms/bfd/server/war/stu3/providers/InpatientClaimTransformer.java index f082319117..7d10476d8f 100644 --- a/apps/bfd-server/bfd-server-war/src/main/java/gov/cms/bfd/server/war/stu3/providers/InpatientClaimTransformer.java +++ b/apps/bfd-server/bfd-server-war/src/main/java/gov/cms/bfd/server/war/stu3/providers/InpatientClaimTransformer.java @@ -9,7 +9,6 @@ import gov.cms.bfd.model.codebook.data.CcwCodebookVariable; import gov.cms.bfd.model.rif.entities.InpatientClaim; import gov.cms.bfd.model.rif.entities.InpatientClaimLine; -import gov.cms.bfd.model.rif.samhsa.HospiceTag; import gov.cms.bfd.model.rif.samhsa.InpatientTag; import gov.cms.bfd.server.war.commons.ClaimType; import gov.cms.bfd.server.war.commons.LookUpSamhsaSecurityTags; @@ -39,8 +38,7 @@ final class InpatientClaimTransformer implements ClaimTransformerInterface { MetricRegistry.name(InpatientClaimTransformer.class.getSimpleName(), "transform"); /** Injecting lookUpSamhsaSecurityTags. */ - @Autowired - private LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags; + @Autowired private LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags; /** * Instantiates a new transformer. @@ -287,14 +285,14 @@ private ExplanationOfBenefit transformClaim(InpatientClaim claimGroup) { TransformerUtils.setLastUpdated(eob, claimGroup.getLastUpdated()); String securityTag = - lookUpSamhsaSecurityTags.getClaimSecurityLevel( - String.valueOf(claimGroup.getClaimId()), InpatientTag.class); + lookUpSamhsaSecurityTags.getClaimSecurityLevel( + String.valueOf(claimGroup.getClaimId()), InpatientTag.class); eob.getMeta() - .addSecurity() - .setSystem("https://terminology.hl7.org/6.1.0/CodeSystem-v3-Confidentiality.html") - .setCode(securityTag) - .setDisplay(securityTag); + .addSecurity() + .setSystem("https://terminology.hl7.org/6.1.0/CodeSystem-v3-Confidentiality.html") + .setCode(securityTag) + .setDisplay(securityTag); return eob; } } diff --git a/apps/bfd-server/bfd-server-war/src/main/java/gov/cms/bfd/server/war/stu3/providers/OutpatientClaimTransformer.java b/apps/bfd-server/bfd-server-war/src/main/java/gov/cms/bfd/server/war/stu3/providers/OutpatientClaimTransformer.java index 8946565d89..00fed8e872 100644 --- a/apps/bfd-server/bfd-server-war/src/main/java/gov/cms/bfd/server/war/stu3/providers/OutpatientClaimTransformer.java +++ b/apps/bfd-server/bfd-server-war/src/main/java/gov/cms/bfd/server/war/stu3/providers/OutpatientClaimTransformer.java @@ -10,7 +10,6 @@ import gov.cms.bfd.model.rif.entities.InpatientClaim; import gov.cms.bfd.model.rif.entities.OutpatientClaim; import gov.cms.bfd.model.rif.entities.OutpatientClaimLine; -import gov.cms.bfd.model.rif.samhsa.InpatientTag; import gov.cms.bfd.model.rif.samhsa.OutpatientTag; import gov.cms.bfd.server.war.commons.ClaimType; import gov.cms.bfd.server.war.commons.LookUpSamhsaSecurityTags; @@ -43,8 +42,7 @@ final class OutpatientClaimTransformer implements ClaimTransformerInterface { MetricRegistry.name(OutpatientClaimTransformer.class.getSimpleName(), "transform"); /** Injecting lookUpSamhsaSecurityTags. */ - @Autowired - private LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags; + @Autowired private LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags; /** * Instantiates a new transformer. @@ -326,14 +324,14 @@ private ExplanationOfBenefit transformClaim(OutpatientClaim claimGroup) { TransformerUtils.setLastUpdated(eob, claimGroup.getLastUpdated()); String securityTag = - lookUpSamhsaSecurityTags.getClaimSecurityLevel( - String.valueOf(claimGroup.getClaimId()), OutpatientTag.class); + lookUpSamhsaSecurityTags.getClaimSecurityLevel( + String.valueOf(claimGroup.getClaimId()), OutpatientTag.class); eob.getMeta() - .addSecurity() - .setSystem("https://terminology.hl7.org/6.1.0/CodeSystem-v3-Confidentiality.html") - .setCode(securityTag) - .setDisplay(securityTag); + .addSecurity() + .setSystem("https://terminology.hl7.org/6.1.0/CodeSystem-v3-Confidentiality.html") + .setCode(securityTag) + .setDisplay(securityTag); return eob; } } diff --git a/apps/bfd-server/bfd-server-war/src/main/java/gov/cms/bfd/server/war/stu3/providers/SNFClaimTransformer.java b/apps/bfd-server/bfd-server-war/src/main/java/gov/cms/bfd/server/war/stu3/providers/SNFClaimTransformer.java index e7efc2f67f..baed6100de 100644 --- a/apps/bfd-server/bfd-server-war/src/main/java/gov/cms/bfd/server/war/stu3/providers/SNFClaimTransformer.java +++ b/apps/bfd-server/bfd-server-war/src/main/java/gov/cms/bfd/server/war/stu3/providers/SNFClaimTransformer.java @@ -10,7 +10,6 @@ import gov.cms.bfd.model.codebook.data.CcwCodebookVariable; import gov.cms.bfd.model.rif.entities.SNFClaim; import gov.cms.bfd.model.rif.entities.SNFClaimLine; -import gov.cms.bfd.model.rif.samhsa.OutpatientTag; import gov.cms.bfd.model.rif.samhsa.SnfTag; import gov.cms.bfd.server.war.commons.ClaimType; import gov.cms.bfd.server.war.commons.CommonTransformerUtils; @@ -44,8 +43,7 @@ public class SNFClaimTransformer implements ClaimTransformerInterface { MetricRegistry.name(SNFClaimTransformer.class.getSimpleName(), "transform"); /** Injecting lookUpSamhsaSecurityTags. */ - @Autowired - private LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags; + @Autowired private LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags; /** * Instantiates a new transformer. @@ -249,14 +247,14 @@ private ExplanationOfBenefit transformClaim(SNFClaim claimGroup) { TransformerUtils.setLastUpdated(eob, claimGroup.getLastUpdated()); String securityTag = - lookUpSamhsaSecurityTags.getClaimSecurityLevel( - String.valueOf(claimGroup.getClaimId()), SnfTag.class); + lookUpSamhsaSecurityTags.getClaimSecurityLevel( + String.valueOf(claimGroup.getClaimId()), SnfTag.class); eob.getMeta() - .addSecurity() - .setSystem("https://terminology.hl7.org/6.1.0/CodeSystem-v3-Confidentiality.html") - .setCode(securityTag) - .setDisplay(securityTag); + .addSecurity() + .setSystem("https://terminology.hl7.org/6.1.0/CodeSystem-v3-Confidentiality.html") + .setCode(securityTag) + .setDisplay(securityTag); return eob; } } diff --git a/apps/bfd-server/bfd-server-war/src/test/java/gov/cms/bfd/server/war/stu3/providers/LookUpSamhsaSecurityTagsTest.java b/apps/bfd-server/bfd-server-war/src/test/java/gov/cms/bfd/server/war/stu3/providers/LookUpSamhsaSecurityTagsTest.java index 9db3b8f17d..79842135fa 100644 --- a/apps/bfd-server/bfd-server-war/src/test/java/gov/cms/bfd/server/war/stu3/providers/LookUpSamhsaSecurityTagsTest.java +++ b/apps/bfd-server/bfd-server-war/src/test/java/gov/cms/bfd/server/war/stu3/providers/LookUpSamhsaSecurityTagsTest.java @@ -1,8 +1,13 @@ package gov.cms.bfd.server.war.stu3.providers; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.*; + import gov.cms.bfd.server.war.commons.LookUpSamhsaSecurityTags; import jakarta.persistence.EntityManager; import jakarta.persistence.Query; +import java.util.HashSet; +import java.util.Set; import org.hl7.fhir.r4.model.CodeableConcept; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -10,55 +15,50 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import java.util.HashSet; -import java.util.Set; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.Mockito.*; - class LookUpSamhsaSecurityTagsTest { - @Mock - private EntityManager entityManager; - - @Mock - private Query query; - - @InjectMocks - private LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags; - - @BeforeEach - void setUp() { - MockitoAnnotations.openMocks(this); // Initialize mocks - } - - @Test - void testGetClaimSecurityLevel_Inpatient() { - CodeableConcept type = new CodeableConcept(); - type.addCoding().setCode("INP"); - - Set mockTags = new HashSet<>(); - mockTags.add("R"); - when(entityManager.createQuery(anyString())).thenReturn(query); - when(query.getResultList()).thenReturn(new java.util.ArrayList<>(mockTags)); - - String securityLevel = lookUpSamhsaSecurityTags.getClaimSecurityLevel(type, "12345"); - assertEquals("Restricted", securityLevel, "Security level should be 'Restricted' for Inpatient claim with 'R' tag"); - } - - @Test - void testGetClaimSecurityLevel_Outpatient() { - CodeableConcept type = new CodeableConcept(); - type.addCoding().setCode("OUT"); - - Set mockTags = new HashSet<>(); - mockTags.add("NormalTag"); - when(entityManager.createQuery(anyString())).thenReturn(query); - when(query.getResultList()).thenReturn(new java.util.ArrayList<>(mockTags)); - - String securityLevel = lookUpSamhsaSecurityTags.getClaimSecurityLevel(type, "67890"); - assertEquals("Normal", securityLevel, "Security level should be 'Normal' for Outpatient claim with 'NormalTag'"); - } - + @Mock private EntityManager entityManager; + + @Mock private Query query; + + @InjectMocks private LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags; + + @BeforeEach + void setUp() { + MockitoAnnotations.openMocks(this); // Initialize mocks + } + + @Test + void testGetClaimSecurityLevel_Inpatient() { + CodeableConcept type = new CodeableConcept(); + type.addCoding().setCode("INP"); + + Set mockTags = new HashSet<>(); + mockTags.add("R"); + when(entityManager.createQuery(anyString())).thenReturn(query); + when(query.getResultList()).thenReturn(new java.util.ArrayList<>(mockTags)); + + String securityLevel = lookUpSamhsaSecurityTags.getClaimSecurityLevel(type, "12345"); + assertEquals( + "Restricted", + securityLevel, + "Security level should be 'Restricted' for Inpatient claim with 'R' tag"); + } + + @Test + void testGetClaimSecurityLevel_Outpatient() { + CodeableConcept type = new CodeableConcept(); + type.addCoding().setCode("OUT"); + + Set mockTags = new HashSet<>(); + mockTags.add("NormalTag"); + when(entityManager.createQuery(anyString())).thenReturn(query); + when(query.getResultList()).thenReturn(new java.util.ArrayList<>(mockTags)); + + String securityLevel = lookUpSamhsaSecurityTags.getClaimSecurityLevel(type, "67890"); + assertEquals( + "Normal", + securityLevel, + "Security level should be 'Normal' for Outpatient claim with 'NormalTag'"); + } } -