-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'BFD-3665' of https://github.com/CMSgov/beneficiary-fhir…
- Loading branch information
Showing
7 changed files
with
91 additions
and
103 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
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
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
98 changes: 49 additions & 49 deletions
98
...war/src/test/java/gov/cms/bfd/server/war/stu3/providers/LookUpSamhsaSecurityTagsTest.java
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 |
---|---|---|
@@ -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'"); | ||
} | ||
} | ||
|