Summary Table
Categories |
Total Count |
PII |
0 |
URL |
0 |
DNS |
0 |
EKL |
0 |
IP |
0 |
PORT |
0 |
VsID |
0 |
CF |
0 |
AI |
0 |
VPD |
0 |
PL |
0 |
Other |
0 |
File Content
package gov.va.med.ewv.controller;
import static org.mockito.Mockito.when;
import static org.hamcrest.Matchers.is;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.http.MediaType;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import gov.va.med.ewv.util.ClaimFormat;
import gov.va.med.ewv.util.ClaimType;
import gov.va.med.ewv.util.EwvUtils;
import gov.va.med.ewv.util.ServiceLine;
import gov.va.med.ars.configuration.AppConfig;
import gov.va.med.ars.configuration.spring.SpringMvcConfig;
import gov.va.med.ars.filter.CORSFilter;
import gov.va.med.ewv.codes.DiagnosisCode;
import gov.va.med.ewv.codes.DiagnosisCodesContainer;
import gov.va.med.ewv.codes.ECodesContainer;
import gov.va.med.ewv.codes.ProcedureCode;
import gov.va.med.ewv.codes.ProcedureCodesContainer;
import gov.va.med.ewv.controller.EwvClaimController;
import gov.va.med.ewv.model.response.AmbulanceCert;
import gov.va.med.ewv.model.response.AmbulanceInfo;
import gov.va.med.ewv.model.response.BillingAndAdmissionInfo;
import gov.va.med.ewv.model.response.DrugLine;
import gov.va.med.ewv.model.response.EwvClaimDetailResponse;
import gov.va.med.ewv.model.response.HealthCareInfoResponse;
import gov.va.med.ewv.model.response.MedicalEquipmentLine;
import gov.va.med.ewv.model.response.PatientHeaderInfo;
import gov.va.med.ewv.model.response.PatientInfo;
import gov.va.med.ewv.model.response.Provider;
import gov.va.med.ewv.model.response.ServiceLineOhiAdjustment;
import gov.va.med.ewv.model.response.ToothLine;
import gov.va.med.ewv.model.response.VendorInfo;
import gov.va.med.ewv.service.IEwvClaimService;
@RunWith(MockitoJUnitRunner.class)
public class EwvClaimControllerTest {
private MockMvc mockMvc;
@Mock
private IEwvClaimService ewvClaimService;
@InjectMocks
private EwvClaimController ewvClaimController;
EwvClaimDetailResponse response;
String pdi = "201736500000002";
PatientHeaderInfo patientHeaderInfo;
PatientInfo patientInfo;
VendorInfo serviceLocationInfo;
VendorInfo billingProviderInfo;
BillingAndAdmissionInfo billingMiscellanous;
DiagnosisCodesContainer diagnosisCodesInfo;
ProcedureCodesContainer procedureCodesInfo;
List<ServiceLine> serviceLinesInfo;
@Before
public void init() throws Exception {
mockMvc = MockMvcBuilders.standaloneSetup(ewvClaimController).addFilters(new CORSFilter()).build();
Long guid = 3L;
String ediClaimKey = "681A4FD0-CE88-7F6C-E053-4A10BF0A3038";
ClaimFormat claimFormat = ClaimFormat.FORMAT5010;
ClaimType claimType = ClaimType.DENTAL;
String memberId = "666666661";
String medicareCrossover = "Y";
String pos = "21";
/* Patient info */
String patientName = "RODGERS-CROMARTIE, DOMINIQUE";
String patientIdNumber = "1234567890";
String patientDob = "01/01/1935";
String patientGender = "M";
String patientAddressLine1 = "1122 Maple Street";
String patientAddressLine2 = "Apt. B";
String patientCity = "NEW YORK";
String patientState = "NY";
String patientPostalCode = "12345";
String patientCountry = "USA";
/* Vendor info */
String serviceVendorName = "GENERAL DIAGNOSTIC HOSPITAL";
String serviceVendorTaxIdNum = "1234567890";
String serviceVendorNpi = "1234567890";
String serviceVendorAddressLine1 = "2000 SOUTH US HIGHWAY 1";
String serviceVendorAddressLine2 = "SUITE 100";
String serviceVendorCity = "NEW YORK";
String serviceVendorState = "NY";
String serviceVendorPostalCode = "12345";
String billingVendorName = "GENERAL MEMORIAL HOSPITAL";
String billingVendorTaxIdNum = "1234567890";
String billingVendorNpi = "1234567890";
String billingVendorAddressLine1 = "1212 SOUTH US HIGHWAY 1";
String billingVendorAddressLine2 = null;
String billingVendorCity = "NEW YORK";
String billingVendorState = "NY";
String billingVendorPostalCode = "12345";
/* Billing info */
String invoicePatientAccountNum = "1721590-2";
String invoiceTypeOfBill = "21";
String invoiceFrequency = "1";
String invoiceStatementFromDate = "01/01/2017";
String invoiceStatementToDate = "02/01/2017";
String invoicePreviousPdi = "1234567890123";
String invoicePatientPaidAmt = "999.99";
String invoicePatientSignature = "B";
String invoicePatientStatus = "UNK";
String invoicePriorAuthorization1 = "12345678901234567890";
String invoicePriorAuthorization2 = "";
String invoiceAdmissionType = "UNK";
String invoiceAdmissionSource = "UNK";
String invoiceAdmissionDate = "01/01/2017";
String invoiceAdmissionHour = "15:00";
String invoiceAccidentDate = "01/01/2017";
String invoiceAccidentIndicator = "123456";
String invoiceProvAcceptsAssignmt = "A"; // which field?
String invoiceAssignmentOfBenefits = "Y";
String invoiceDischargeDateHour = "02/01/2017 15:00";
String invoiceAdmissionDateHour = "01/01/2017 15:00";
String svcLineTotalClaimCharges = "999.99";
String pcn = invoicePatientAccountNum;
String pcnShort = EwvUtils.shorten(pcn, 20);
String hccodesPoaNotes = "123456789012345678901234567890";
String hccodesPrincipalDiagnosis = "998";
String hccodesAdmittingDiagnosis = "998";
String hccodesReasonForVists = "998";
String hccodesECode = "998";
String hccodesPrincipalProcedure = "998";
String hccodesPrincipalProcDate = "03/01/2017";
String admittingDiagnosis = hccodesAdmittingDiagnosis;
String reasonForVisit = hccodesReasonForVists;
String eCode = hccodesECode;
String poaNotesPlain = hccodesPoaNotes;
String poaNotesLong = EwvUtils.addLineBreaks(poaNotesPlain);
String poaNotesShort = EwvUtils.shorten(poaNotesLong, 15);
boolean usePoaNotesModelPanel = false;
if (poaNotesShort.endsWith("...")) {
usePoaNotesModelPanel = true;
}
String priorAuthorizationReferralShort = EwvUtils.shorten(invoicePriorAuthorization1, 20);
String renderingPrvdName = "";
String renderingPrvdNpi = "";
String renderingPrvdTaxonomyCode = "";
String dischargeDateOrHour = "02/01/17";
String reasonForVisit2_5010 = "";
String reasonForVisit3_5010 = "";
String referralShort_5010 = "";
String referralLong_5010 = "";
// Needed to altered once the updated model jar is added
// String reasonForVisit2_5010 = claim.getHccodesReasonForVisit2_5010();
// String reasonForVisit3_5010 = claim.getHccodesReasonForVisit3_5010();
// String referralLong_5010 = claim.getInvoiceReferral_5010();
patientHeaderInfo = new PatientHeaderInfo(claimFormat.getValueOf(), claimType, medicareCrossover, patientName,
billingVendorNpi, memberId, billingVendorTaxIdNum, pdi, pcn, pcnShort, Boolean.FALSE);
patientInfo = new PatientInfo(patientName, patientIdNumber, patientDob, "", patientGender, patientAddressLine1,
patientAddressLine2, patientCity, patientState, patientPostalCode, patientCountry);
serviceLocationInfo = new VendorInfo(serviceVendorName, serviceVendorTaxIdNum, serviceVendorNpi, "",
serviceVendorAddressLine1, serviceVendorAddressLine2, serviceVendorCity, serviceVendorState,
serviceVendorPostalCode, "");
billingProviderInfo = new VendorInfo(billingVendorName, billingVendorTaxIdNum, billingVendorNpi, "",
billingVendorAddressLine1, billingVendorAddressLine2, billingVendorCity, billingVendorState,
billingVendorPostalCode, "");
billingMiscellanous = new BillingAndAdmissionInfo();
billingMiscellanous.setStatementFromTo(invoiceStatementFromDate + " - " + invoiceStatementToDate);
billingMiscellanous.setPatientAccountNumber(pcn);
billingMiscellanous.setPatientPaidAmount(invoicePatientPaidAmt);
billingMiscellanous.setPatientSignature(invoicePatientSignature);
billingMiscellanous.setPatientStatus(invoicePatientStatus);
billingMiscellanous.setPriorAuthorizationReferralLong(invoicePriorAuthorization1);
billingMiscellanous.setPriorAuthorizationReferralShort(priorAuthorizationReferralShort);
billingMiscellanous.setPreviousPDIOrClaimNumber(invoicePreviousPdi);
billingMiscellanous.setAdmissionType(invoiceAdmissionType);
billingMiscellanous.setAdmissionSource(invoiceAdmissionSource);
billingMiscellanous.setAdmissionDate(invoiceAdmissionDate);
billingMiscellanous.setAdmissionHour(invoiceAdmissionHour);
billingMiscellanous.setPlaceOfService(pos);
billingMiscellanous.setAccidentIndicator(invoiceAccidentIndicator);
billingMiscellanous.setAccidentDate(invoiceAccidentDate);
billingMiscellanous.setAssignmentOfBenefits(invoiceAssignmentOfBenefits);
billingMiscellanous.setDischargeDateOrHour(invoiceDischargeDateHour);
billingMiscellanous.setTotalClaimCharges(svcLineTotalClaimCharges);
billingMiscellanous.setStatementFromToEWV2(invoiceStatementFromDate + " Thru " + invoiceStatementToDate);
billingMiscellanous.setProviderAcceptsAssignment(invoiceProvAcceptsAssignmt);
billingMiscellanous.setFrequency(invoiceFrequency);
billingMiscellanous.setPoaNotesLong(poaNotesLong);
billingMiscellanous.setPoaNotesShort(poaNotesShort);
billingMiscellanous.setAdmittingDiagnosis(admittingDiagnosis);
billingMiscellanous.setReasonForVisit(reasonForVisit);
billingMiscellanous.setEeCode(eCode);
billingMiscellanous.setUsePoaNotesModalPanel(usePoaNotesModelPanel);
billingMiscellanous.setMedicareIcn("");
billingMiscellanous.setAdmissionDateOrHour("01/01/17 15:00");
billingMiscellanous.setRenderingPrvdName("");
billingMiscellanous.setRenderingPrvdName(renderingPrvdName);
billingMiscellanous.setRenderingPrvdNpi(renderingPrvdNpi);
billingMiscellanous.setRenderingPrvdTaxonomyCode(renderingPrvdTaxonomyCode);
billingMiscellanous.setDischargeDateOrHour(dischargeDateOrHour);
billingMiscellanous.setReasonForVisit2_5010(reasonForVisit2_5010);
billingMiscellanous.setReasonForVisit3_5010(reasonForVisit3_5010);
billingMiscellanous.setReferralLong_5010(referralLong_5010);
billingMiscellanous.setReferralShort_5010(referralShort_5010);
String presentOnAdmissionNotesShort = null;
String presentOnAdmissionNotesLong = null;
boolean usePresentOnAdmissionModalPanel = false;
String principalDiagnosisMasterCode = null;
String principalDiagnosisPoa = null;
String admittingDiagnosisMasterCode = null;
String reasonForVisitMasterCode = null;
String eCodeMasterCode = null;
List<DiagnosisCode> diagnosisCodes = null;
diagnosisCodesInfo = new DiagnosisCodesContainer(presentOnAdmissionNotesShort, presentOnAdmissionNotesLong,
usePresentOnAdmissionModalPanel, principalDiagnosisMasterCode, principalDiagnosisPoa,
admittingDiagnosisMasterCode, reasonForVisitMasterCode, eCodeMasterCode, diagnosisCodes);
String principalProcedure = null;
String dateOfPrincipalProcedure = null;
// For Phase II, there is no need to use four columns
List<ProcedureCode> procedureCodes = null;
procedureCodesInfo = new ProcedureCodesContainer(principalProcedure, dateOfPrincipalProcedure, procedureCodes);
HealthCareInfoResponse healthCareInfo = null;
String beginDateOfService = "03/11/17";
String endDateOfService = "03/11/17";
String dateOfService = null; // Not sure this is used
String revCode = null;
String procedureCode = null;
String ndcCode = null;
String modifiers = null;
String quantityOrType = null;
// Ohi Stuff
String primaryPayerPaidAmount = null;
List<ServiceLineOhiAdjustment> primaryOhiServiceLineAdjustments = null;
String secondaryPayerPaidAmount = null;
List<ServiceLineOhiAdjustment> secondaryOhiServiceLineAdjustments = null;
// Added quantity and type for Phase II, when they should be separate
String quantity = null;
String type = null;
String serviceTax = null;
String facilityTax = null;
String charge = null;
String lineNumber = null;
List<DrugLine> listOfDrugLines = null;
List<ToothLine> listOfTeeth = null;
List<MedicalEquipmentLine> listOfEquipment = null;
String dxDtPointers = null;
String salesTax = null;
List<Provider> listOfProviderInfo = null;
// String pos;
// 5010 Stuff
String pickupAddressLine1 = "54321 Maple Street";
String pickupAddressLine2 = "Apt. 303";
String pickupCity = "Springfield";
String pickupState = "OH";
String pickupZip = "54321";
String dropoffAddressLine1 = "12345 Maple Street";
String dropoffAddressLine2 = null;
String dropoffCity = "Springfield";
String dropoffState = "OH";
String dropoffZip = "54321";
String transportReasonCode = "A";
String transportDistance = "14";
String roundTripPurpose = "Medical care";
String roundTripPurposeShort = null;
boolean useRoundTripPurposeModalPanel = false;
String stretcherPurpose = "Lorem ipsum dolor sit amet";
String stretcherPurposeShort = null;
boolean useStretcherPurposeModalPanel = false;
List<AmbulanceCert> certs = new ArrayList<>();
AmbulanceCert amb = new AmbulanceCert("N", "N");
certs.add(amb);
AmbulanceInfo serviceLineLevelAmbulanceInfo = new AmbulanceInfo(pickupAddressLine1, pickupAddressLine2,
pickupCity, pickupState, pickupZip, dropoffAddressLine1, dropoffAddressLine2, dropoffCity, dropoffState,
dropoffZip, transportReasonCode, transportDistance, roundTripPurpose, roundTripPurposeShort,
useRoundTripPurposeModalPanel, stretcherPurpose, stretcherPurposeShort, useStretcherPurposeModalPanel,
certs);
ServiceLine sl = new ServiceLine(dateOfService, beginDateOfService, endDateOfService, revCode, procedureCode,
ndcCode, modifiers, quantityOrType, quantity, type, primaryPayerPaidAmount,
primaryOhiServiceLineAdjustments, secondaryPayerPaidAmount, secondaryOhiServiceLineAdjustments,
serviceTax, facilityTax, charge, lineNumber, listOfDrugLines, listOfTeeth, listOfEquipment,
dxDtPointers, salesTax, "", "", listOfProviderInfo, pos, serviceLineLevelAmbulanceInfo);
serviceLinesInfo = new ArrayList<>();
serviceLinesInfo.add(sl);
AmbulanceInfo claimLevelAmbulanceInfo = new AmbulanceInfo(pickupAddressLine1, pickupAddressLine2,
pickupCity, pickupState, pickupZip, dropoffAddressLine1, dropoffAddressLine2, dropoffCity, dropoffState,
dropoffZip, transportReasonCode, transportDistance, roundTripPurpose, roundTripPurposeShort,
useRoundTripPurposeModalPanel, stretcherPurpose, stretcherPurposeShort, useStretcherPurposeModalPanel,
certs);
ECodesContainer e_CodesInfo = null;
response = new EwvClaimDetailResponse(patientHeaderInfo, patientInfo, serviceLocationInfo, billingProviderInfo,
billingMiscellanous, diagnosisCodesInfo, procedureCodesInfo, e_CodesInfo, healthCareInfo,
serviceLinesInfo, null, claimLevelAmbulanceInfo);
}
@Test
public void getDetail_success() throws Exception {
when(ewvClaimService.getEwvClaim(pdi)).thenReturn(response);
//Run Integration test instead - this does not return response
/*mockMvc.perform(get("/api/v1/ewvClaim/{pdiNumber}", pdi)).andDo(print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.patientHeaderInfo.claimFormat", is("NONE")))
.andExpect(jsonPath("$.patientHeaderInfo.claimType", is("DENTAL")))
.andExpect(jsonPath("$.patientHeaderInfo.medicareCrossOver", is("Y")))
.andExpect(jsonPath("$.patientHeaderInfo.patientName", is("RODGERS-CROMARTIE, DOMINIQUE")))
.andExpect(jsonPath("$.patientHeaderInfo.billingNPI", is("billingNPI")))
.andExpect(jsonPath("$.patientHeaderInfo.memberID", is("666666661")))
.andExpect(jsonPath("$.patientHeaderInfo.tin", is("tin123")))
.andExpect(jsonPath("$.patientHeaderInfo.pdi", is("2017 365 00 000002")))
.andExpect(jsonPath("$.patientHeaderInfo.pcn", is("A1234567890123456")))
.andExpect(jsonPath("$.patientHeaderInfo.pcnShort", is("A123456789...")))
.andExpect(jsonPath("$.patientHeaderInfo.usePcnModalPanel", is(Boolean.FALSE)));*/
}
}