diff --git a/src/main/java/com/iemr/mmu/data/anc/ANCCareDetails.java b/src/main/java/com/iemr/mmu/data/anc/ANCCareDetails.java index 36ba14ed..6733d848 100644 --- a/src/main/java/com/iemr/mmu/data/anc/ANCCareDetails.java +++ b/src/main/java/com/iemr/mmu/data/anc/ANCCareDetails.java @@ -185,6 +185,7 @@ public class ANCCareDetails { public ANCCareDetails() { super(); + this.processed = "N"; // TODO Auto-generated constructor stub } diff --git a/src/main/java/com/iemr/mmu/data/anc/ANCWomenVaccineDetail.java b/src/main/java/com/iemr/mmu/data/anc/ANCWomenVaccineDetail.java index c20e7f89..4bfefa01 100644 --- a/src/main/java/com/iemr/mmu/data/anc/ANCWomenVaccineDetail.java +++ b/src/main/java/com/iemr/mmu/data/anc/ANCWomenVaccineDetail.java @@ -130,6 +130,7 @@ public class ANCWomenVaccineDetail { public ANCWomenVaccineDetail() { super(); + this.processed = "N"; // TODO Auto-generated constructor stub } diff --git a/src/test/java/com/iemr/mmu/service/anc/ANCServiceImplTest.java b/src/test/java/com/iemr/mmu/service/anc/ANCServiceImplTest.java index f901ec9c..524eef0a 100644 --- a/src/test/java/com/iemr/mmu/service/anc/ANCServiceImplTest.java +++ b/src/test/java/com/iemr/mmu/service/anc/ANCServiceImplTest.java @@ -48,6 +48,13 @@ import java.util.*; import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.argThat; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.*; class ANCServiceImplTest { @@ -696,11 +703,11 @@ void testUpdateANCDoctorData_allBranchesSuccess() throws Exception { when(commonDoctorServiceImpl.callTmForSpecialistSlotBook(any(), any())).thenReturn(1); when(teleConsultationServiceImpl.createTCRequest(any())).thenReturn(1); when(commonDoctorServiceImpl.updateDocFindings(any())).thenReturn(1); - when(commonDoctorServiceImpl.updateBenFlowtableAfterDocDataUpdate(any(), anyBoolean(), anyBoolean(), any())).thenReturn(1); + when(commonDoctorServiceImpl.updateBenFlowtableAfterDocDataUpdate(any(), anyBoolean(), anyBoolean(), any(),null)).thenReturn(1); when(commonNurseServiceImpl.updatePrescription(any())).thenReturn(1); when(ancDoctorServiceImpl.updateBenANCDiagnosis(any())).thenReturn(1); when(commonNurseServiceImpl.saveBenInvestigation(any())).thenReturn(1L); - when(commonNurseServiceImpl.saveBenPrescribedDrugsList(any())).thenReturn(1); + when(commonNurseServiceImpl.saveBenPrescribedDrugsList(any())).thenReturn(new HashMap()); when(commonDoctorServiceImpl.updateBenReferDetails(any())).thenReturn(1L); try { @@ -726,11 +733,11 @@ void testUpdateANCDoctorData_failureBranches() throws Exception { when(commonDoctorServiceImpl.callTmForSpecialistSlotBook(any(), any())).thenReturn(0); when(teleConsultationServiceImpl.createTCRequest(any())).thenReturn(0); when(commonDoctorServiceImpl.updateDocFindings(any())).thenReturn(0); - when(commonDoctorServiceImpl.updateBenFlowtableAfterDocDataUpdate(any(), anyBoolean(), anyBoolean(), any())).thenReturn(0); + when(commonDoctorServiceImpl.updateBenFlowtableAfterDocDataUpdate(any(), anyBoolean(), anyBoolean(), any(),null)).thenReturn(0); when(commonNurseServiceImpl.updatePrescription(any())).thenReturn(0); when(ancDoctorServiceImpl.updateBenANCDiagnosis(any())).thenReturn(0); when(commonNurseServiceImpl.saveBenInvestigation(any())).thenReturn(0L); - when(commonNurseServiceImpl.saveBenPrescribedDrugsList(any())).thenReturn(0); + when(commonNurseServiceImpl.saveBenPrescribedDrugsList(any())).thenReturn(new HashMap()); when(commonDoctorServiceImpl.updateBenReferDetails(any())).thenReturn(0L); try { @@ -759,13 +766,13 @@ void testSaveANCDoctorData_allBranchesSuccess() throws Exception { when(commonDoctorServiceImpl.callTmForSpecialistSlotBook(any(), any())).thenReturn(1); when(teleConsultationServiceImpl.createTCRequest(any())).thenReturn(1); when(commonDoctorServiceImpl.saveDocFindings(any())).thenReturn(1); - when(commonDoctorServiceImpl.updateBenFlowtableAfterDocDataSave(any(), anyBoolean(), anyBoolean(), any())).thenReturn(1); + when(commonDoctorServiceImpl.updateBenFlowtableAfterDocDataSave(any(), anyBoolean(), anyBoolean(), any(),null)).thenReturn(1); when(commonNurseServiceImpl.savePrescriptionDetailsAndGetPrescriptionID( any(Long.class), any(Long.class), any(Integer.class), any(String.class), any(String.class), any(Long.class), any(Integer.class), any(Integer.class), any(ArrayList.class) )).thenReturn(1L); when(commonNurseServiceImpl.saveBenInvestigation(any())).thenReturn(1L); - when(commonNurseServiceImpl.saveBenPrescribedDrugsList(any())).thenReturn(1); + when(commonNurseServiceImpl.saveBenPrescribedDrugsList(any())).thenReturn(new HashMap()); when(ancDoctorServiceImpl.saveBenANCDiagnosis(any(), any())).thenReturn(1L); when(commonDoctorServiceImpl.saveBenReferDetails(any())).thenReturn(1L); @@ -793,13 +800,13 @@ void testSaveANCDoctorData_failureBranches() throws Exception { when(commonDoctorServiceImpl.callTmForSpecialistSlotBook(any(), any())).thenReturn(0); when(teleConsultationServiceImpl.createTCRequest(any())).thenReturn(0); when(commonDoctorServiceImpl.saveDocFindings(any())).thenReturn(0); - when(commonDoctorServiceImpl.updateBenFlowtableAfterDocDataSave(any(), anyBoolean(), anyBoolean(), any())).thenReturn(0); + when(commonDoctorServiceImpl.updateBenFlowtableAfterDocDataSave(any(), anyBoolean(), anyBoolean(), any(),null)).thenReturn(0); when(commonNurseServiceImpl.savePrescriptionDetailsAndGetPrescriptionID( any(Long.class), any(Long.class), any(Integer.class), any(String.class), any(String.class), any(Long.class), any(Integer.class), any(Integer.class), any(ArrayList.class) )).thenReturn(0L); when(commonNurseServiceImpl.saveBenInvestigation(any())).thenReturn(0L); - when(commonNurseServiceImpl.saveBenPrescribedDrugsList(any())).thenReturn(0); + when(commonNurseServiceImpl.saveBenPrescribedDrugsList(any())).thenReturn(new HashMap()); when(ancDoctorServiceImpl.saveBenANCDiagnosis(any(), any())).thenReturn(0L); when(commonDoctorServiceImpl.saveBenReferDetails(any())).thenReturn(0L); @@ -1099,10 +1106,10 @@ void testUpdateANCDoctorData_allBranches() throws Exception { // Mock all service calls to return success when(doctorService.updateDocFindings(any())).thenReturn(1); - when(doctorService.updateBenFlowtableAfterDocDataUpdate(any(), anyBoolean(), anyBoolean(), any())).thenReturn(1); + when(doctorService.updateBenFlowtableAfterDocDataUpdate(any(), anyBoolean(), anyBoolean(), any(),null)).thenReturn(1); when(nurseService.savePrescriptionDetailsAndGetPrescriptionID(any(), any(), any(), any(), any(), any(), any(), any(), any())).thenReturn(1L); when(nurseService.saveBenInvestigation(any())).thenReturn(1L); - when(nurseService.saveBenPrescribedDrugsList(any())).thenReturn(1); + when(nurseService.saveBenPrescribedDrugsList(any())).thenReturn(new HashMap()); when(ancDoctorService.updateBenANCDiagnosis(any())).thenReturn(1); when(doctorService.updateBenReferDetails(any())).thenReturn(1L); @@ -1244,10 +1251,10 @@ void testSaveANCDoctorData_comprehensiveSuccess() throws Exception { when(doctorService.callTmForSpecialistSlotBook(any(), any())).thenReturn(1); when(teleService.createTCRequest(any())).thenReturn(1); when(doctorService.saveDocFindings(any())).thenReturn(1); - when(doctorService.updateBenFlowtableAfterDocDataSave(any(), anyBoolean(), anyBoolean(), any())).thenReturn(1); + when(doctorService.updateBenFlowtableAfterDocDataSave(any(), anyBoolean(), anyBoolean(), any(),null)).thenReturn(1); when(nurseService.savePrescriptionDetailsAndGetPrescriptionID(any(), any(), any(), any(), any(), any(), any(), any(), any())).thenReturn(1L); when(nurseService.saveBenInvestigation(any())).thenReturn(1L); - when(nurseService.saveBenPrescribedDrugsList(any())).thenReturn(1); + when(nurseService.saveBenPrescribedDrugsList(any())).thenReturn(new HashMap()); when(ancDoctorService.saveBenANCDiagnosis(any(), any())).thenReturn(1L); when(doctorService.saveBenReferDetails(any())).thenReturn(1L); @@ -1338,9 +1345,9 @@ void testSaveANCDoctorData_prescriptionLogic() throws Exception { when(doctorService.saveDocFindings(any())).thenReturn(1); when(nurseService.savePrescriptionDetailsAndGetPrescriptionID(any(), any(), any(), any(), any(), any(), any(), any(), any())).thenReturn(100L); when(nurseService.saveBenInvestigation(any())).thenReturn(1L); - when(nurseService.saveBenPrescribedDrugsList(any())).thenReturn(1); + when(nurseService.saveBenPrescribedDrugsList(any())).thenReturn(new HashMap()); when(ancDoctorService.saveBenANCDiagnosis(any(), any())).thenReturn(1L); - when(doctorService.updateBenFlowtableAfterDocDataSave(any(), anyBoolean(), anyBoolean(), any())).thenReturn(1); + when(doctorService.updateBenFlowtableAfterDocDataSave(any(), anyBoolean(), anyBoolean(), any(),null)).thenReturn(1); Long result = service.saveANCDoctorData(obj, "auth"); assertNotNull(result); @@ -1405,9 +1412,9 @@ void testSaveANCDoctorData_prescriptionDrugDetailProcessing() throws Exception { when(doctorService.saveDocFindings(any())).thenReturn(1); when(nurseService.savePrescriptionDetailsAndGetPrescriptionID(any(), any(), any(), any(), any(), any(), any(), any(), any())).thenReturn(999L); when(nurseService.saveBenInvestigation(any())).thenReturn(1L); - when(nurseService.saveBenPrescribedDrugsList(any())).thenReturn(2); // Return > 0 + when(nurseService.saveBenPrescribedDrugsList(any())).thenReturn(new HashMap()); when(ancDoctorService.saveBenANCDiagnosis(any(), any())).thenReturn(1L); - when(doctorService.updateBenFlowtableAfterDocDataSave(any(), anyBoolean(), anyBoolean(), any())).thenReturn(1); + when(doctorService.updateBenFlowtableAfterDocDataSave(any(), anyBoolean(), anyBoolean(), any(),null)).thenReturn(1); Long result = service.saveANCDoctorData(obj, "auth"); assertNotNull(result); @@ -1476,9 +1483,9 @@ void testUpdateANCDoctorData_prescriptionCoverage() throws Exception { when(nurseService.updatePrescription(any())).thenReturn(1); when(ancDoctorService.updateBenANCDiagnosis(any())).thenReturn(1); when(nurseService.saveBenInvestigation(any())).thenReturn(1L); - when(nurseService.saveBenPrescribedDrugsList(any())).thenReturn(1); + when(nurseService.saveBenPrescribedDrugsList(any())).thenReturn(new HashMap()); when(doctorService.updateBenReferDetails(any())).thenReturn(1L); - when(doctorService.updateBenFlowtableAfterDocDataUpdate(any(), anyBoolean(), anyBoolean(), any())).thenReturn(1); + when(doctorService.updateBenFlowtableAfterDocDataUpdate(any(), anyBoolean(), anyBoolean(), any(), null)).thenReturn(1); // Call method - should cover prescription array processing service.updateANCDoctorData(obj, "auth"); diff --git a/src/test/java/com/iemr/mmu/service/benFlowStatus/CommonBenStatusFlowServiceImplTest.java b/src/test/java/com/iemr/mmu/service/benFlowStatus/CommonBenStatusFlowServiceImplTest.java index 95ab4418..4c4cc2c4 100644 --- a/src/test/java/com/iemr/mmu/service/benFlowStatus/CommonBenStatusFlowServiceImplTest.java +++ b/src/test/java/com/iemr/mmu/service/benFlowStatus/CommonBenStatusFlowServiceImplTest.java @@ -390,7 +390,7 @@ void testUpdateBenFlowNurseAfterNurseUpdateNCD_Screening_Exception() { @Test @DisplayName("Test updateBenFlowAfterDocData - Success") - void testUpdateBenFlowAfterDocData_Success() { + void testUpdateBenFlowAfterDocData_Success() throws Exception { // Arrange Long benFlowID = 1L; Long benRegID = 1L; @@ -404,12 +404,12 @@ void testUpdateBenFlowAfterDocData_Success() { Timestamp tcDate = new Timestamp(System.currentTimeMillis()); when(beneficiaryFlowStatusRepo.updateBenFlowStatusAfterDoctorActivity( - benFlowID, benRegID, benID, docFlag, pharmaFlag, oncologistFlag, tcSpecialistFlag, tcUserID, tcDate)) + benFlowID, benRegID, benID, docFlag, pharmaFlag, oncologistFlag, tcSpecialistFlag, tcUserID, tcDate, null)) .thenReturn(1); // Act int result = commonBenStatusFlowService.updateBenFlowAfterDocData( - benFlowID, benRegID, benID, benVisitID, docFlag, pharmaFlag, oncologistFlag, tcSpecialistFlag, tcUserID, tcDate); + benFlowID, benRegID, benID, benVisitID, docFlag, pharmaFlag, oncologistFlag, tcSpecialistFlag, tcUserID, tcDate, null); // Assert assertEquals(1, result); @@ -417,7 +417,7 @@ void testUpdateBenFlowAfterDocData_Success() { @Test @DisplayName("Test updateBenFlowAfterDocData - Exception") - void testUpdateBenFlowAfterDocData_Exception() { + void testUpdateBenFlowAfterDocData_Exception() throws Exception { // Arrange Long benFlowID = 1L; Long benRegID = 1L; @@ -431,12 +431,12 @@ void testUpdateBenFlowAfterDocData_Exception() { Timestamp tcDate = new Timestamp(System.currentTimeMillis()); when(beneficiaryFlowStatusRepo.updateBenFlowStatusAfterDoctorActivity( - benFlowID, benRegID, benID, docFlag, pharmaFlag, oncologistFlag, tcSpecialistFlag, tcUserID, tcDate)) + benFlowID, benRegID, benID, docFlag, pharmaFlag, oncologistFlag, tcSpecialistFlag, tcUserID, tcDate, null)) .thenThrow(new RuntimeException("Database error")); // Act int result = commonBenStatusFlowService.updateBenFlowAfterDocData( - benFlowID, benRegID, benID, benVisitID, docFlag, pharmaFlag, oncologistFlag, tcSpecialistFlag, tcUserID, tcDate); + benFlowID, benRegID, benID, benVisitID, docFlag, pharmaFlag, oncologistFlag, tcSpecialistFlag, tcUserID, tcDate, null); // Assert assertEquals(0, result); @@ -459,12 +459,12 @@ void testUpdateBenFlowAfterDocDataUpdate_SuccessWithExistingPharmaFlag() throws when(beneficiaryFlowStatusRepo.getPharmaFlag(benFlowID)).thenReturn((short) 1); when(beneficiaryFlowStatusRepo.updateBenFlowStatusAfterDoctorActivity( - benFlowID, benRegID, benID, docFlag, (short) 1, oncologistFlag, tcSpecialistFlag, tcUserID, tcDate)) + benFlowID, benRegID, benID, docFlag, (short) 1, oncologistFlag, tcSpecialistFlag, tcUserID, tcDate, null)) .thenReturn(1); // Act int result = commonBenStatusFlowService.updateBenFlowAfterDocDataUpdate( - benFlowID, benRegID, benID, benVisitID, docFlag, pharmaFlag, oncologistFlag, tcSpecialistFlag, tcUserID, tcDate); + benFlowID, benRegID, benID, benVisitID, docFlag, pharmaFlag, oncologistFlag, tcSpecialistFlag, tcUserID, tcDate, null); // Assert assertEquals(1, result); @@ -487,12 +487,12 @@ void testUpdateBenFlowAfterDocDataUpdate_SuccessWithNewPharmaFlag() throws Excep when(beneficiaryFlowStatusRepo.getPharmaFlag(benFlowID)).thenReturn((short) 0); when(beneficiaryFlowStatusRepo.updateBenFlowStatusAfterDoctorActivity( - benFlowID, benRegID, benID, docFlag, pharmaFlag, oncologistFlag, tcSpecialistFlag, tcUserID, tcDate)) + benFlowID, benRegID, benID, docFlag, pharmaFlag, oncologistFlag, tcSpecialistFlag, tcUserID, tcDate, null)) .thenReturn(1); // Act int result = commonBenStatusFlowService.updateBenFlowAfterDocDataUpdate( - benFlowID, benRegID, benID, benVisitID, docFlag, pharmaFlag, oncologistFlag, tcSpecialistFlag, tcUserID, tcDate); + benFlowID, benRegID, benID, benVisitID, docFlag, pharmaFlag, oncologistFlag, tcSpecialistFlag, tcUserID, tcDate, null); // Assert assertEquals(1, result); @@ -519,7 +519,7 @@ void testUpdateBenFlowAfterDocDataUpdate_Exception() { // Act & Assert Exception exception = assertThrows(Exception.class, () -> { commonBenStatusFlowService.updateBenFlowAfterDocDataUpdate( - benFlowID, benRegID, benID, benVisitID, docFlag, pharmaFlag, oncologistFlag, tcSpecialistFlag, tcUserID, tcDate); + benFlowID, benRegID, benID, benVisitID, docFlag, pharmaFlag, oncologistFlag, tcSpecialistFlag, tcUserID, tcDate, null); }); assertNotNull(exception); @@ -541,12 +541,12 @@ void testUpdateBenFlowAfterDocDataUpdateWDF_Success() throws Exception { when(beneficiaryFlowStatusRepo.getPharmaFlag(benFlowID)).thenReturn((short) 0); when(beneficiaryFlowStatusRepo.updateBenFlowStatusAfterDoctorActivityWDF( - benFlowID, benRegID, benID, docFlag, pharmaFlag, oncologistFlag, tcUserID, tcDate)) + benFlowID, benRegID, benID, docFlag, pharmaFlag, oncologistFlag, tcUserID, tcDate, null)) .thenReturn(1); // Act int result = commonBenStatusFlowService.updateBenFlowAfterDocDataUpdateWDF( - benFlowID, benRegID, benID, benVisitID, docFlag, pharmaFlag, oncologistFlag, tcUserID, tcDate); + benFlowID, benRegID, benID, benVisitID, docFlag, pharmaFlag, oncologistFlag, tcUserID, tcDate, null); // Assert assertEquals(1, result); @@ -569,12 +569,12 @@ void testUpdateBenFlowAfterDocDataUpdateTCSpecialist_Success() throws Exception when(beneficiaryFlowStatusRepo.getPharmaFlag(benFlowID)).thenReturn((short) 0); when(beneficiaryFlowStatusRepo.updateBenFlowStatusAfterDoctorActivityTCSpecialist( - benFlowID, benRegID, benID, pharmaFlag, oncologistFlag, tcSpecialistFlag)) + benFlowID, benRegID, benID, pharmaFlag, oncologistFlag, tcSpecialistFlag, null)) .thenReturn(1); // Act int result = commonBenStatusFlowService.updateBenFlowAfterDocDataUpdateTCSpecialist( - benFlowID, benRegID, benID, benVisitID, docFlag, pharmaFlag, oncologistFlag, tcSpecialistFlag, tcUserID, tcDate); + benFlowID, benRegID, benID, benVisitID, docFlag, pharmaFlag, oncologistFlag, tcSpecialistFlag, tcUserID, tcDate, null); // Assert assertEquals(1, result); diff --git a/src/test/java/com/iemr/mmu/service/generalOPD/GeneralOPDServiceImplTest.java b/src/test/java/com/iemr/mmu/service/generalOPD/GeneralOPDServiceImplTest.java index 51cc9560..32107a16 100644 --- a/src/test/java/com/iemr/mmu/service/generalOPD/GeneralOPDServiceImplTest.java +++ b/src/test/java/com/iemr/mmu/service/generalOPD/GeneralOPDServiceImplTest.java @@ -777,10 +777,10 @@ void saveDoctorData_success_allBranches() throws Exception { // (Assume InputMapper is static, so skip actual mapping in test) // Mock all service calls to return success - when(docService.updateBenFlowtableAfterDocDataSave(any(), anyBoolean(), anyBoolean(), any())).thenReturn(1); + when(docService.updateBenFlowtableAfterDocDataSave(any(), anyBoolean(), anyBoolean(), any(), null)).thenReturn(1); when(nurseService.saveBenPrescription(any())).thenReturn(2L); when(nurseService.saveBenInvestigation(any())).thenReturn(2L); - when(nurseService.saveBenPrescribedDrugsList(any())).thenReturn(2); + when(nurseService.saveBenPrescribedDrugsList(any())).thenReturn(new HashMap()); when(docService.saveDocFindings(any())).thenReturn(2); when(docService.saveBenReferDetails(any())).thenReturn(2L); @@ -828,10 +828,10 @@ void updateGeneralOPDDoctorData_success_allBranches() throws Exception { when(util.getCreatedBy()).thenReturn("1"); // Mock all service calls to return success - when(docService.updateBenFlowtableAfterDocDataUpdate(any(), anyBoolean(), anyBoolean(), any())).thenReturn(1); + when(docService.updateBenFlowtableAfterDocDataUpdate(any(), anyBoolean(), anyBoolean(), any(), null)).thenReturn(1); when(nurseService.updatePrescription(any())).thenReturn(2); when(nurseService.saveBenInvestigation(any())).thenReturn(2L); - when(nurseService.saveBenPrescribedDrugsList(any())).thenReturn(2); + when(nurseService.saveBenPrescribedDrugsList(any())).thenReturn(new HashMap()); when(docService.updateDocFindings(any())).thenReturn(2); when(docService.updateBenReferDetails(any())).thenReturn(2L); @@ -903,10 +903,10 @@ void updateGeneralOPDDoctorData_teleconsultationBranch_success() throws Exceptio // Mock slot booking and TC request creation when(docService.callTmForSpecialistSlotBook(any(), any())).thenReturn(1); when(teleService.createTCRequest(any())).thenReturn(1); - when(docService.updateBenFlowtableAfterDocDataUpdate(any(), anyBoolean(), anyBoolean(), any())).thenReturn(1); + when(docService.updateBenFlowtableAfterDocDataUpdate(any(), anyBoolean(), anyBoolean(), any(), null)).thenReturn(1); when(nurseService.updatePrescription(any())).thenReturn(2); when(nurseService.saveBenInvestigation(any())).thenReturn(2L); - when(nurseService.saveBenPrescribedDrugsList(any())).thenReturn(2); + when(nurseService.saveBenPrescribedDrugsList(any())).thenReturn(new HashMap()); when(docService.updateDocFindings(any())).thenReturn(2); when(docService.updateBenReferDetails(any())).thenReturn(2L); @@ -1043,10 +1043,10 @@ void saveDoctorData_teleconsultationBranch_success() throws Exception { // Mock service calls to return success values when(docService.callTmForSpecialistSlotBook(any(), any())).thenReturn(1); // Must return > 0 when(teleService.createTCRequest(any())).thenReturn(1); - when(docService.updateBenFlowtableAfterDocDataSave(any(), anyBoolean(), anyBoolean(), any())).thenReturn(1); + when(docService.updateBenFlowtableAfterDocDataSave(any(), anyBoolean(), anyBoolean(), any(), null)).thenReturn(1); when(nurseService.saveBenPrescription(any())).thenReturn(2L); when(nurseService.saveBenInvestigation(any())).thenReturn(2L); - when(nurseService.saveBenPrescribedDrugsList(any())).thenReturn(2); + when(nurseService.saveBenPrescribedDrugsList(any())).thenReturn(new HashMap()); when(docService.saveDocFindings(any())).thenReturn(2); when(docService.saveBenReferDetails(any())).thenReturn(2L); @@ -1173,7 +1173,7 @@ void updateGeneralOPDDoctorData_emptyPrescription_success() throws Exception { // Mock slot booking and TC request creation when(docService.callTmForSpecialistSlotBook(any(), any())).thenReturn(1); when(teleService.createTCRequest(any())).thenReturn(1); - when(docService.updateBenFlowtableAfterDocDataUpdate(any(), anyBoolean(), anyBoolean(), any())).thenReturn(1); + when(docService.updateBenFlowtableAfterDocDataUpdate(any(), anyBoolean(), anyBoolean(), any(), null)).thenReturn(1); when(nurseService.updatePrescription(any())).thenReturn(2); when(nurseService.saveBenInvestigation(any())).thenReturn(2L); when(docService.updateDocFindings(any())).thenReturn(2); diff --git a/src/test/java/com/iemr/mmu/service/quickConsultation/QuickConsultationServiceImplTest.java b/src/test/java/com/iemr/mmu/service/quickConsultation/QuickConsultationServiceImplTest.java index 9f2426e4..00f2c5bb 100644 --- a/src/test/java/com/iemr/mmu/service/quickConsultation/QuickConsultationServiceImplTest.java +++ b/src/test/java/com/iemr/mmu/service/quickConsultation/QuickConsultationServiceImplTest.java @@ -37,6 +37,14 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyList; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.anyShort; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.*; import static org.junit.jupiter.api.Assertions.*; import java.util.*; @@ -279,9 +287,9 @@ void testUpdateGeneralOPDQCDoctorData_basicFlow() throws Exception { obj.add("refer", new JsonObject()); // Mocks for TC request block when(commonNurseServiceImpl.updatePrescription(any())).thenReturn(1); - when(commonNurseServiceImpl.saveBenPrescribedDrugsList(anyList())).thenReturn(1); + when(commonNurseServiceImpl.saveBenPrescribedDrugsList(anyList())).thenReturn(new HashMap()); when(commonDoctorServiceImpl.updateBenClinicalObservations(any())).thenReturn(1); - when(commonDoctorServiceImpl.updateBenFlowtableAfterDocDataUpdate(any(), anyBoolean(), anyBoolean(), any())).thenReturn(1); + when(commonDoctorServiceImpl.updateBenFlowtableAfterDocDataUpdate(any(), anyBoolean(), anyBoolean(), any(),null)).thenReturn(1); when(commonDoctorServiceImpl.updateBenReferDetails(any())).thenReturn(1L); when(commonDoctorServiceImpl.callTmForSpecialistSlotBook(any(), anyString())).thenReturn(1); when(teleConsultationServiceImpl.createTCRequest(any())).thenReturn(1); @@ -321,7 +329,7 @@ void testQuickConsultDoctorDataInsert_tcRequestFlow() throws Exception { when(mockObs.getClinicalObservationID()).thenReturn(10L); when(commonNurseServiceImpl.saveBeneficiaryPrescription(any())).thenReturn(10L); when(commonDoctorServiceImpl.saveBenReferDetails(any())).thenReturn(1L); - when(commonDoctorServiceImpl.updateBenFlowtableAfterDocDataSave(any(), anyBoolean(), anyBoolean(), any())).thenReturn(1); + when(commonDoctorServiceImpl.updateBenFlowtableAfterDocDataSave(any(), anyBoolean(), anyBoolean(), any(), null)).thenReturn(1); when(commonDoctorServiceImpl.callTmForSpecialistSlotBook(any(), anyString())).thenReturn(1); when(teleConsultationServiceImpl.createTCRequest(any())).thenReturn(1); Integer result = service.quickConsultDoctorDataInsert(obj, "auth"); @@ -364,9 +372,9 @@ void testQuickConsultDoctorDataInsert_prescriptionBranch() throws Exception { when(mockObs.getClinicalObservationID()).thenReturn(10L); when(commonNurseServiceImpl.saveBeneficiaryPrescription(any())).thenReturn(10L); // Mock the prescription save branch - when(commonNurseServiceImpl.saveBenPrescribedDrugsList(anyList())).thenReturn(1); + when(commonNurseServiceImpl.saveBenPrescribedDrugsList(anyList())).thenReturn(new HashMap()); when(commonDoctorServiceImpl.saveBenReferDetails(any())).thenReturn(1L); - when(commonDoctorServiceImpl.updateBenFlowtableAfterDocDataSave(any(), anyBoolean(), anyBoolean(), any())).thenReturn(1); + when(commonDoctorServiceImpl.updateBenFlowtableAfterDocDataSave(any(), anyBoolean(), anyBoolean(), any(),null)).thenReturn(1); Integer result = service.quickConsultDoctorDataInsert(obj, "auth"); assertEquals(1, result); }