Skip to content

Commit

Permalink
BFD-3665 fixing unit tests
Browse files Browse the repository at this point in the history
BFD-3665 fixing unit tests
  • Loading branch information
MahiFentaye committed Jan 6, 2025
1 parent f66fd07 commit f287011
Show file tree
Hide file tree
Showing 33 changed files with 265 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,17 @@ final class CarrierClaimTransformerV2 implements ClaimTransformerInterfaceV2 {
* @param metricRegistry the metric registry
* @param drugCodeDisplayLookup the drug code display lookup
* @param npiOrgLookup the npi org lookup
* @param lookUpSamhsaSecurityTags SamhsaSecurityTags lookup
*/
public CarrierClaimTransformerV2(
MetricRegistry metricRegistry,
FdaDrugCodeDisplayLookup drugCodeDisplayLookup,
NPIOrgLookup npiOrgLookup) {
NPIOrgLookup npiOrgLookup,
LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags) {
this.metricRegistry = requireNonNull(metricRegistry);
this.npiOrgLookup = requireNonNull(npiOrgLookup);
this.drugCodeDisplayLookup = requireNonNull(drugCodeDisplayLookup);
this.lookUpSamhsaSecurityTags = requireNonNull(lookUpSamhsaSecurityTags);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,17 @@ final class DMEClaimTransformerV2 implements ClaimTransformerInterfaceV2 {
* @param metricRegistry the metric registry
* @param drugCodeDisplayLookup the drug code display lookup
* @param npiOrgLookup the npi display lookup
* @param lookUpSamhsaSecurityTags SamhsaSecurityTags lookup
*/
DMEClaimTransformerV2(
MetricRegistry metricRegistry,
FdaDrugCodeDisplayLookup drugCodeDisplayLookup,
NPIOrgLookup npiOrgLookup) {
NPIOrgLookup npiOrgLookup,
LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags) {
this.metricRegistry = requireNonNull(metricRegistry);
this.drugCodeDisplayLookup = requireNonNull(drugCodeDisplayLookup);
this.npiOrgLookup = npiOrgLookup;
this.lookUpSamhsaSecurityTags = lookUpSamhsaSecurityTags;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,15 @@ final class HHAClaimTransformerV2 implements ClaimTransformerInterfaceV2 {
*
* @param metricRegistry the metric registry
* @param npiOrgLookup the npi org lookup
* @param lookUpSamhsaSecurityTags SamhsaSecurityTags lookup
*/
public HHAClaimTransformerV2(MetricRegistry metricRegistry, NPIOrgLookup npiOrgLookup) {
public HHAClaimTransformerV2(
MetricRegistry metricRegistry,
NPIOrgLookup npiOrgLookup,
LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags) {
this.metricRegistry = requireNonNull(metricRegistry);
this.npiOrgLookup = requireNonNull(npiOrgLookup);
this.lookUpSamhsaSecurityTags = requireNonNull(lookUpSamhsaSecurityTags);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,15 @@ final class HospiceClaimTransformerV2 implements ClaimTransformerInterfaceV2 {
*
* @param metricRegistry the metric registry
* @param npiOrgLookup the npi org lookup
* @param lookUpSamhsaSecurityTags SamhsaSecurityTags lookup
*/
public HospiceClaimTransformerV2(MetricRegistry metricRegistry, NPIOrgLookup npiOrgLookup) {
public HospiceClaimTransformerV2(
MetricRegistry metricRegistry,
NPIOrgLookup npiOrgLookup,
LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags) {
this.metricRegistry = requireNonNull(metricRegistry);
this.npiOrgLookup = requireNonNull(npiOrgLookup);
this.lookUpSamhsaSecurityTags = requireNonNull(lookUpSamhsaSecurityTags);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,15 @@ final class InpatientClaimTransformerV2 implements ClaimTransformerInterfaceV2 {
*
* @param metricRegistry the metric registry
* @param npiOrgLookup the npi org lookup
* @param lookUpSamhsaSecurityTags SamhsaSecurityTag lookup
*/
public InpatientClaimTransformerV2(MetricRegistry metricRegistry, NPIOrgLookup npiOrgLookup) {
public InpatientClaimTransformerV2(
MetricRegistry metricRegistry,
NPIOrgLookup npiOrgLookup,
LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags) {
this.metricRegistry = requireNonNull(metricRegistry);
this.npiOrgLookup = requireNonNull(npiOrgLookup);
this.lookUpSamhsaSecurityTags = lookUpSamhsaSecurityTags;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,17 @@ final class OutpatientClaimTransformerV2 implements ClaimTransformerInterfaceV2
* @param metricRegistry the metric registry
* @param drugCodeDisplayLookup the drug code display lookup
* @param npiOrgLookup the npi org lookup
* @param lookUpSamhsaSecurityTags SamhsaSecurityTags lookup
*/
public OutpatientClaimTransformerV2(
MetricRegistry metricRegistry,
FdaDrugCodeDisplayLookup drugCodeDisplayLookup,
NPIOrgLookup npiOrgLookup) {
NPIOrgLookup npiOrgLookup,
LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags) {
this.metricRegistry = requireNonNull(metricRegistry);
this.npiOrgLookup = requireNonNull(npiOrgLookup);
this.drugCodeDisplayLookup = requireNonNull(drugCodeDisplayLookup);
this.lookUpSamhsaSecurityTags = requireNonNull(lookUpSamhsaSecurityTags);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,15 @@ public class SNFClaimTransformerV2 implements ClaimTransformerInterfaceV2 {
*
* @param metricRegistry the metric registry
* @param npiOrgLookup the npi org lookup
* @param lookUpSamhsaSecurityTags SamhsaSecurityTags lookup
*/
public SNFClaimTransformerV2(MetricRegistry metricRegistry, NPIOrgLookup npiOrgLookup) {
public SNFClaimTransformerV2(
MetricRegistry metricRegistry,
NPIOrgLookup npiOrgLookup,
LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags) {
this.metricRegistry = requireNonNull(metricRegistry);
this.npiOrgLookup = requireNonNull(npiOrgLookup);
this.lookUpSamhsaSecurityTags = requireNonNull(lookUpSamhsaSecurityTags);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,12 @@ public class FissClaimTransformerV2 extends AbstractTransformerV2
* called by tests.
*
* @param metricRegistry the metric registry
* @param lookUpSamhsaSecurityTags SamhsaSecurityTags lookup
*/
public FissClaimTransformerV2(MetricRegistry metricRegistry) {
public FissClaimTransformerV2(
MetricRegistry metricRegistry, LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags) {
this.metricRegistry = requireNonNull(metricRegistry);
this.lookUpSamhsaSecurityTags = lookUpSamhsaSecurityTags;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@ public class McsClaimTransformerV2 extends AbstractTransformerV2
* called by tests.
*
* @param metricRegistry the metric registry
* @param lookUpSamhsaSecurityTags SamhsaSecurityTags lookup
*/
public McsClaimTransformerV2(MetricRegistry metricRegistry) {
public McsClaimTransformerV2(
MetricRegistry metricRegistry, LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags) {
this.metricRegistry = metricRegistry;
this.lookUpSamhsaSecurityTags = lookUpSamhsaSecurityTags;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
Expand All @@ -23,6 +24,7 @@
import gov.cms.bfd.server.war.ServerTestUtils;
import gov.cms.bfd.server.war.commons.CCWUtils;
import gov.cms.bfd.server.war.commons.ClaimType;
import gov.cms.bfd.server.war.commons.LookUpSamhsaSecurityTags;
import gov.cms.bfd.server.war.commons.MedicareSegment;
import gov.cms.bfd.server.war.commons.TransformerConstants;
import gov.cms.bfd.server.war.commons.carin.C4BBClaimProfessionalAndNonClinicianCareTeamRole;
Expand Down Expand Up @@ -127,10 +129,14 @@ public void before() throws IOException {
when(metricsTimer.time()).thenReturn(metricsTimerContext);
npiOrgLookup = RDATestUtils.mockNPIOrgLookup();
FdaDrugCodeDisplayLookup drugCodeDisplayLookup = RDATestUtils.fdaFakeDrugCodeDisplayLookup();
LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags = mock(LookUpSamhsaSecurityTags.class);

carrierClaimTransformer =
new CarrierClaimTransformerV2(
metricRegistry, drugCodeDisplayLookup, NPIOrgLookup.createNpiOrgLookup());
metricRegistry,
drugCodeDisplayLookup,
NPIOrgLookup.createNpiOrgLookup(),
lookUpSamhsaSecurityTags);

claim = generateClaim();
ExplanationOfBenefit genEob = carrierClaimTransformer.transform(claim, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import gov.cms.bfd.model.rif.samples.StaticRifResourceGroup;
import gov.cms.bfd.server.war.ServerTestUtils;
import gov.cms.bfd.server.war.commons.CCWUtils;
import gov.cms.bfd.server.war.commons.LookUpSamhsaSecurityTags;
import gov.cms.bfd.server.war.commons.ProfileConstants;
import gov.cms.bfd.server.war.commons.TransformerConstants;
import gov.cms.bfd.server.war.utils.RDATestUtils;
Expand Down Expand Up @@ -88,6 +89,9 @@ public final class DMEClaimTransformerV2Test {
/** The NPI Org lookup. */
@Mock NPIOrgLookup mockNpiOrgLookup;

/** The SamhsaSecurityTag lookup. */
@Mock LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags;

/**
* Generates the Claim object to be used in multiple tests.
*
Expand Down Expand Up @@ -121,7 +125,8 @@ public void before() throws IOException {
when(mockNpiOrgLookup.retrieveNPIOrgDisplay(any()))
.thenReturn(Optional.of("207X00000X\tOrthopaedic Surgery"));
dmeClaimTransformer =
new DMEClaimTransformerV2(metricRegistry, fdaDrugCodeDisplayLookup, mockNpiOrgLookup);
new DMEClaimTransformerV2(
metricRegistry, fdaDrugCodeDisplayLookup, mockNpiOrgLookup, lookUpSamhsaSecurityTags);
claim = generateClaim();
ExplanationOfBenefit genEob = dmeClaimTransformer.transform(claim, false);
IParser parser = fhirContext.newJsonParser();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import gov.cms.bfd.model.rif.entities.HHAClaim;
import gov.cms.bfd.model.rif.samples.StaticRifResourceGroup;
import gov.cms.bfd.server.war.ServerTestUtils;
import gov.cms.bfd.server.war.commons.LookUpSamhsaSecurityTags;
import gov.cms.bfd.server.war.commons.ProfileConstants;
import gov.cms.bfd.server.war.commons.TransformerConstants;
import gov.cms.bfd.server.war.utils.RDATestUtils;
Expand Down Expand Up @@ -86,6 +87,9 @@ public class HHAClaimTransformerV2Test {
/** The metrics registry. */
@Mock MetricRegistry metricRegistry;

/** The SamhsaSecurityTag lookup. */
@Mock LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags;

/** The metrics timer. Used for determining the timer was started. */
@Mock Timer metricsTimer;

Expand Down Expand Up @@ -127,7 +131,8 @@ public void before() throws IOException {
npiOrgLookup = RDATestUtils.mockNPIOrgLookup();

hhaClaimTransformer =
new HHAClaimTransformerV2(metricRegistry, NPIOrgLookup.createNpiOrgLookup());
new HHAClaimTransformerV2(
metricRegistry, NPIOrgLookup.createNpiOrgLookup(), lookUpSamhsaSecurityTags);
claim = generateClaim();
ExplanationOfBenefit genEob = hhaClaimTransformer.transform(claim, false);
IParser parser = fhirContext.newJsonParser();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import gov.cms.bfd.model.rif.samples.StaticRifResourceGroup;
import gov.cms.bfd.server.war.ServerTestUtils;
import gov.cms.bfd.server.war.commons.ClaimType;
import gov.cms.bfd.server.war.commons.LookUpSamhsaSecurityTags;
import gov.cms.bfd.server.war.commons.MedicareSegment;
import gov.cms.bfd.server.war.commons.ProfileConstants;
import gov.cms.bfd.server.war.commons.TransformerConstants;
Expand Down Expand Up @@ -86,6 +87,9 @@ public final class HospiceClaimTransformerV2Test {
/** The metrics registry. */
@Mock MetricRegistry metricRegistry;

/** The SamhsaSecurityTag lookup. */
@Mock LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags;

/** The metrics timer. Used for determining the timer was started. */
@Mock Timer metricsTimer;

Expand All @@ -107,7 +111,8 @@ public void generateClaim() throws FHIRException, IOException {
npiOrgLookup = RDATestUtils.mockNPIOrgLookup();

hospiceClaimTransformer =
new HospiceClaimTransformerV2(metricRegistry, NPIOrgLookup.createNpiOrgLookup());
new HospiceClaimTransformerV2(
metricRegistry, NPIOrgLookup.createNpiOrgLookup(), lookUpSamhsaSecurityTags);
List<Object> parsedRecords =
ServerTestUtils.parseData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import gov.cms.bfd.model.rif.entities.InpatientClaim;
import gov.cms.bfd.model.rif.samples.StaticRifResourceGroup;
import gov.cms.bfd.server.war.ServerTestUtils;
import gov.cms.bfd.server.war.commons.LookUpSamhsaSecurityTags;
import gov.cms.bfd.server.war.commons.ProfileConstants;
import gov.cms.bfd.server.war.commons.TransformerConstants;
import gov.cms.bfd.server.war.utils.RDATestUtils;
Expand Down Expand Up @@ -83,6 +84,9 @@ public final class InpatientClaimTransformerV2Test {
/** The metrics registry. */
@Mock MetricRegistry metricRegistry;

/** The SamhsaSecurityTag lookup. */
@Mock LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags;

/** The metrics timer. Used for determining the timer was started. */
@Mock Timer metricsTimer;

Expand Down Expand Up @@ -126,7 +130,8 @@ public void before() throws IOException {
npiOrgLookup = RDATestUtils.mockNPIOrgLookup();

inpatientClaimTransformer =
new InpatientClaimTransformerV2(metricRegistry, NPIOrgLookup.createNpiOrgLookup());
new InpatientClaimTransformerV2(
metricRegistry, NPIOrgLookup.createNpiOrgLookup(), lookUpSamhsaSecurityTags);
claim = generateClaim();
ExplanationOfBenefit genEob = inpatientClaimTransformer.transform(claim, false);
IParser parser = fhirContext.newJsonParser();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import gov.cms.bfd.model.rif.entities.OutpatientClaim;
import gov.cms.bfd.model.rif.samples.StaticRifResourceGroup;
import gov.cms.bfd.server.war.ServerTestUtils;
import gov.cms.bfd.server.war.commons.LookUpSamhsaSecurityTags;
import gov.cms.bfd.server.war.commons.ProfileConstants;
import gov.cms.bfd.server.war.commons.TransformerConstants;
import gov.cms.bfd.server.war.utils.RDATestUtils;
Expand Down Expand Up @@ -83,6 +84,9 @@ public final class OutpatientClaimTransformerV2Test {
/** The metrics timer. Used for determining the timer was started. */
@Mock Timer metricsTimer;

/** The SamhsaSecurityTag lookup. */
@Mock LookUpSamhsaSecurityTags lookUpSamhsaSecurityTags;

/** The metrics timer context. Used for determining the timer was stopped. */
@Mock Timer.Context metricsTimerContext;

Expand Down Expand Up @@ -124,7 +128,10 @@ public void before() throws IOException {

outpatientClaimTransformer =
new OutpatientClaimTransformerV2(
metricRegistry, drugCodeDisplayLookup, NPIOrgLookup.createNpiOrgLookup());
metricRegistry,
drugCodeDisplayLookup,
NPIOrgLookup.createNpiOrgLookup(),
lookUpSamhsaSecurityTags);
claim = generateClaim();
ExplanationOfBenefit genEob = outpatientClaimTransformer.transform(claim, false);
IParser parser = fhirContext.newJsonParser();
Expand Down
Loading

0 comments on commit f287011

Please sign in to comment.