Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…-data into BFD-3665

BFD-3665 formatting
  • Loading branch information
MahiFentaye committed Dec 19, 2024
2 parents e027fc1 + ec14071 commit c2c5921
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 103 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
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;
import org.mockito.InjectMocks;
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<String> 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<String> 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<String> 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<String> 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'");
}
}

0 comments on commit c2c5921

Please sign in to comment.